如果我运行文件的 HTML 版本,它会在慢速模式下工作(但在快速模式下会失败)。
我尝试使用 java 的 setspeed 方法,但这不起作用(可能是因为它在以后的版本中被贬值了)。然后我尝试添加手动线程重量时间(在它失败的地方之前),但它也失败了。
无论如何,这是我的java代码:
import com.thoughtworks.selenium.Selenium;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebDriverBackedSelenium;
import org.openqa.selenium.WebElement;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import com.thoughtworks.selenium.SeleneseTestBase;
public class tradePagesNotLoad extends SeleneseTestBase{
private Selenium selenium;
@Before
public void setUp() throws Exception {
WebDriver driver = new FirefoxDriver();
String baseUrl = "http://www.fsdafdscsa.com/";
selenium = new WebDriverBackedSelenium(driver, baseUrl);
}
@Test
public void testA9() throws Exception {
selenium.open("");
selenium.click("link=Sign In");
selenium.waitForPageToLoad("30000");
selenium.type("id=login_username", "fsadfsa");
selenium.type("id=login_password", "asweqr");
selenium.click("name=login_button");
selenium.waitForPageToLoad("30000");
verifyTrue(selenium.isElementPresent("link=Sign Out"));
selenium.click("link=Trade");
selenium.waitForPageToLoad("30000");
String sellButtonText = selenium.getText("xpath=(//button[@type='button'])[7]");
System.out.println(sellButtonText);
assertNotEquals("Loading...", selenium.getEval("storedVars['sellButtonText']"));
String buyButtonText = selenium.getText("xpath=(//button[@type='button'])[8]");
System.out.println(buyButtonText);
assertNotEquals("Loading...", selenium.getEval("storedVars['buyButtonText']"));
String bidPrice = selenium.getText("id=pretty_bid_price");
System.out.println(bidPrice);
assertNotEquals("Loading...", selenium.getEval("storedVars['bidPrice']"));
String askPrice = selenium.getText("id=pretty_ask_price");
System.out.println(askPrice);
assertNotEquals("Loading...", selenium.getEval("storedVars['askPrice']"));
}
@After
public void tearDown() throws Exception {
selenium.stop();
}
}
代码在第一个 assertNotEquals 处失败。任何建议,将不胜感激。