在selenium webdriver中一天后的测试用例

时间:2014-04-14 08:16:16

标签: java selenium selenium-webdriver

以下是我的代码。当我录制并在日食中运行时,它最初成功;但是有一天我运行了相同的测试用例,现在它失败了。建议我修改我的测试的内容和位置,以便它能正常运行。

   package testing;

        import java.util.regex.Pattern;
        import java.util.concurrent.TimeUnit;

        import org.junit.*;

        import static org.junit.Assert.*;
        import static org.hamcrest.CoreMatchers.*;

        import org.openqa.selenium.*;
        import org.openqa.selenium.chrome.ChromeDriver;
        import org.openqa.selenium.firefox.FirefoxDriver;
        import org.openqa.selenium.support.ui.Select;

        public class Men_Testing {
          private WebDriver driver;
          private String baseUrl;
          private boolean acceptNextAlert = true;
          private StringBuffer verificationErrors = new StringBuffer();

          @Before
          public void setUp() throws Exception {
            driver = new FirefoxDriver();
            baseUrl = "http://staging.vfitshoes.com/";
            driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
          }

          @Test
          public void testUntitled() throws Exception {
            driver.get(baseUrl + "/");
            driver.findElement(By.cssSelector("li.doright > a")).click();
            driver.findElement(By.id("email")).clear();
            driver.findElement(By.id("email")).sendKeys("8803477");
            driver.findElement(By.linkText("Sign-In")).click();
            driver.findElement(By.cssSelector("#category > li > a")).click();
            driver.findElement(By.id("dolist")).click();
            new Select(driver.findElement(By.id("select-sort"))).selectByVisibleText("Price Low To High");
            new Select(driver.findElement(By.id("select-sort"))).selectByVisibleText("Price High To Low");
            new Select(driver.findElement(By.id("select-sort"))).selectByVisibleText("Shoe Name A to Z");
            new Select(driver.findElement(By.id("select-sort"))).selectByVisibleText("Shoe Name Z to A");
            new Select(driver.findElement(By.id("no-on-page"))).selectByVisibleText("40");
            new Select(driver.findElement(By.id("no-on-page"))).selectByVisibleText("60");
            new Select(driver.findElement(By.id("no-on-page"))).selectByVisibleText("100");
            driver.findElement(By.xpath("//div[@id='pagination-data']/ul/li[3]")).click();
            driver.findElement(By.linkText("3")).click();
            driver.findElement(By.xpath("//div[@id='pagination-data']/ul/li[6]")).click();
            driver.findElement(By.xpath("//div[@id='pagination-data']/ul/li")).click();
            driver.findElement(By.cssSelector("li.control-btn.paginate-no")).click();
            new Select(driver.findElement(By.id("no-on-page"))).selectByVisibleText("20");
            new Select(driver.findElement(By.id("select-sort"))).selectByVisibleText("VFit First");
            driver.findElement(By.cssSelector("div.slideThree > label")).click();

            driver.get(baseUrl + "/shoes_all_view.jsp?so=-4&pn=1&g=1&style=%25|Sneakers%20%26%20Athletic%20Shoes");
            driver.findElement(By.linkText("Athletic & Sneakers")).click();
            driver.findElement(By.cssSelector("img.image-small")).click();
           // new Select(driver.findElement(By.name("variant_id"))).selectByVisibleText("Black/Charcoal/True Red");
            driver.findElement(By.linkText("Back to Previous Page")).click();
            driver.findElement(By.xpath("//img[contains(@src,'http://www.zappos.com/images/z/2/5/4/8/3/9/2548398-p-DETAILED.jpg')]")).click();
            new Select(driver.findElement(By.name("variant_id"))).selectByVisibleText("Gray/Coral/Black");
            new Select(driver.findElement(By.name("variant_id"))).selectByVisibleText("Dress Blues/Gum");
            driver.findElement(By.linkText("Back to Previous Page")).click();
            driver.findElement(By.xpath("//img[contains(@src,'http://www.zappos.com/images/z/2/4/5/4/5/9/2454597-p-DETAILED.jpg')]")).click();
            new Select(driver.findElement(By.name("variant_id"))).selectByVisibleText("Khaki/Black");
            driver.findElement(By.linkText("Back to Previous Page")).click();
            driver.findElement(By.xpath("//img[contains(@src,'http://www.zappos.com/images/z/2/5/0/8/5/2/2508529-p-DETAILED.jpg')]")).click();
            driver.findElement(By.linkText("Back to Previous Page")).click();
            driver.findElement(By.xpath("//img[contains(@src,'http://www.zappos.com/images/z/2/4/1/4/5/5/2414557-p-DETAILED.jpg')]")).click();
            driver.findElement(By.linkText("Back to Previous Page")).click();
            driver.findElement(By.xpath("//img[contains(@src,'http://www.zappos.com/images/z/2/5/1/6/4/3/2516433-p-DETAILED.jpg')]")).click();
            driver.findElement(By.linkText("Back to Previous Page")).click();
            driver.findElement(By.xpath("//img[contains(@src,'http://www.zappos.com/images/z/1/8/5/1/4/9/1851491-p-DETAILED.jpg')]")).click();
            driver.findElement(By.linkText("Back to Previous Page")).click();
            driver.findElement(By.xpath("//img[contains(@src,'http://www.zappos.com/images/z/2/5/1/0/3/9/2510393-p-DETAILED.jpg')]")).click();
            driver.findElement(By.linkText("Back to Previous Page")).click();
            driver.findElement(By.xpath("//img[contains(@src,'http://www.zappos.com/images/z/1/0/6/4/9/2/1064923-p-DETAILED.jpg')]")).click();
            driver.findElement(By.linkText("Back to Previous Page")).click();
            driver.findElement(By.xpath("//img[contains(@src,'http://www.zappos.com/images/z/2/5/4/8/3/3/2548338-p-DETAILED.jpg')]")).click();
            driver.findElement(By.linkText("Back to Previous Page")).click();
            driver.findElement(By.xpath("//img[contains(@src,'http://www.zappos.com/images/z/2/4/0/5/4/9/2405496-p-DETAILED.jpg')]")).click();
            driver.findElement(By.linkText("Back to Previous Page")).click();

            driver.get(baseUrl + "/shoes_all_view.jsp?so=-4&pn=1&g=1&style=%25|Sneakers%20%26%20Athletic%20Shoes");
            driver.findElement(By.linkText("Boots")).click();
            driver.findElement(By.cssSelector("img.image-small")).click();
            new Select(driver.findElement(By.name("variant_id"))).selectByVisibleText("Dark Brown");
            driver.findElement(By.cssSelector("a > img")).click();
            // ERROR: Caught exception [ERROR: Unsupported command [waitForPopUp | _blank | 30000]]

            driver.get(baseUrl + "/shoes_all_view.jsp?so=-4&pn=1&g=1&style=%25|Boots");
            driver.findElement(By.xpath("//img[contains(@src,'http://www.zappos.com/images/z/2/1/1/5/5/1/2115515-p-DETAILED.jpg')]")).click();
            driver.findElement(By.linkText("Back to Previous Page")).click();
            driver.findElement(By.xpath("//img[contains(@src,'http://www.zappos.com/images/z/2/2/2/6/7/7/2226774-p-DETAILED.jpg')]")).click();
            driver.findElement(By.linkText("Back to Previous Page")).click();
            Thread.sleep(2000);
            driver.findElement(By.xpath("//img[contains(@src,'http://www.zappos.com/images/z/1/6/3/6/5/1/163651-p-DETAILED.jpg')]")).click();
            driver.findElement(By.linkText("Back to Previous Page")).click();
            driver.findElement(By.xpath("//img[contains(@src,'http://www.zappos.com/images/z/2/4/6/2/5/8/2462587-p-DETAILED.jpg')]")).click();
            driver.findElement(By.linkText("Back to Previous Page")).click();
            driver.findElement(By.xpath("//img[contains(@src,'http://www.zappos.com/images/z/2/0/8/8/4/2/2088423-p-DETAILED.jpg')]")).click();
            driver.findElement(By.linkText("Back to Previous Page")).click();
            driver.findElement(By.xpath("//img[contains(@src,'http://www.zappos.com/images/z/2/4/6/8/4/3/2468435-p-DETAILED.jpg')]")).click();
            driver.findElement(By.linkText("Back to Previous Page")).click();
            driver.findElement(By.xpath("//img[contains(@src,'http://www.zappos.com/images/z/2/7/8/6/6/3/2786632-p-DETAILED.jpg')]")).click();
            driver.findElement(By.linkText("Back to Previous Page")).click();

            driver.get(baseUrl + "/shoes_all_view.jsp?so=-4&pn=1&g=1&style=%25|Boots");
            driver.findElement(By.linkText("Boat Shoes")).click();
            driver.findElement(By.cssSelector("img.image-small")).click();
            new Select(driver.findElement(By.name("variant_id"))).selectByVisibleText("Dark Tan");
            driver.findElement(By.linkText("Back to Previous Page")).click();
            driver.findElement(By.xpath("//img[contains(@src,'http://www.zappos.com/images/z/2/2/7/6/3/0/2276308-p-DETAILED.jpg')]")).click();
            new Select(driver.findElement(By.name("variant_id"))).selectByVisibleText("Black");
            driver.findElement(By.linkText("Back to Previous Page")).click();
            driver.findElement(By.xpath("//img[contains(@src,'http://www.zappos.com/images/z/1/3/6/5/3/4/1365346-p-DETAILED.jpg')]")).click();
            driver.findElement(By.linkText("Back to Previous Page")).click();
            driver.findElement(By.xpath("//img[contains(@src,'http://www.zappos.com/images/z/2/2/6/9/3/2/2269328-p-DETAILED.jpg')]")).click();
            driver.findElement(By.linkText("Back to Previous Page")).click();
            driver.findElement(By.xpath("//img[contains(@src,'http://www.zappos.com/images/z/2/0/7/9/6/6/2079660-p-DETAILED.jpg')]")).click();
            driver.findElement(By.linkText("Back to Previous Page")).click();
            driver.findElement(By.xpath("//img[contains(@src,'http://www.zappos.com/images/z/2/5/1/9/3/2/2519326-p-DETAILED.jpg')]")).click();
            driver.findElement(By.linkText("Back to Previous Page")).click();
            driver.findElement(By.xpath("//img[contains(@src,'http://www.zappos.com/images/z/2/5/1/8/8/6/2518864-p-DETAILED.jpg')]")).click();
            driver.findElement(By.linkText("Back to Previous Page")).click();
            driver.findElement(By.linkText("Climbing")).click();
            driver.findElement(By.cssSelector("img.image-small")).click();
            new Select(driver.findElement(By.name("variant_id"))).selectByVisibleText("Green/Blue");
            driver.findElement(By.linkText("Back to Previous Page")).click();
            driver.findElement(By.xpath("//img[contains(@src,'http://www.zappos.com/images/z/1/3/1/4/4/3/131443-p-DETAILED.jpg')]")).click();
            driver.findElement(By.linkText("Back to Previous Page")).click();
            driver.findElement(By.xpath("//img[contains(@src,'http://www.zappos.com/images/z/1/7/8/1/2/1/1781215-p-DETAILED.jpg')]")).click();
            driver.findElement(By.linkText("Back to Previous Page")).click();
            driver.findElement(By.xpath("//img[contains(@src,'http://www.zappos.com/images/749/7493102/1396-802332-t.jpg')]")).click();
            driver.findElement(By.linkText("Back to Previous Page")).click();
            driver.findElement(By.linkText("Clogs & Mules")).click();
            driver.findElement(By.cssSelector("img.image-small")).click();
            driver.findElement(By.linkText("Back to Previous Page")).click();
            driver.findElement(By.xpath("//img[contains(@src,'http://www.zappos.com/images/z/2/6/5/5/6/4/2655641-p-DETAILED.jpg')]")).click();
            driver.findElement(By.linkText("Back to Previous Page")).click();
            driver.findElement(By.xpath("//img[contains(@src,'http://www.zappos.com/images/z/2/6/4/5/5/9/2645591-p-DETAILED.jpg')]")).click();
            driver.findElement(By.linkText("Back to Previous Page")).click();
            driver.findElement(By.xpath("//img[contains(@src,'http://www.zappos.com/images/z/2/3/2/5/3/5/2325356-p-DETAILED.jpg')]")).click();
            driver.findElement(By.linkText("Back to Previous Page")).click();
            driver.findElement(By.xpath("//img[contains(@src,'http://www.zappos.com/images/z/2/5/4/8/2/2/2548225-p-DETAILED.jpg')]")).click();
            driver.findElement(By.linkText("Back to Previous Page")).click();
            driver.findElement(By.linkText("Hiking & Camping")).click();
            driver.findElement(By.cssSelector("img.image-small")).click();
            driver.findElement(By.linkText("Back to Previous Page")).click();
            driver.findElement(By.xpath("//img[contains(@src,'http://www.zappos.com/images/z/2/3/5/5/3/5/2355351-p-DETAILED.jpg')]")).click();
            driver.findElement(By.linkText("Back to Previous Page")).click();
            driver.findElement(By.linkText("Loafers")).click();
            driver.findElement(By.cssSelector("img.image-small")).click();
            driver.findElement(By.linkText("Back to Previous Page")).click();
            driver.findElement(By.xpath("//img[contains(@src,'http://www.zappos.com/images/z/1/7/1/5/7/7/1715774-p-DETAILED.jpg')]")).click();
            driver.findElement(By.linkText("Back to Previous Page")).click();
            driver.findElement(By.xpath("//img[contains(@src,'http://www.zappos.com/images/z/2/3/5/9/9/4/2359946-p-DETAILED.jpg')]")).click();
            driver.findElement(By.linkText("Back to Previous Page")).click();
            driver.findElement(By.xpath("//img[contains(@src,'http://www.zappos.com/images/z/2/5/9/7/9/4/2597940-p-DETAILED.jpg')]")).click();
            driver.findElement(By.linkText("Back to Previous Page")).click();
            driver.findElement(By.xpath("//img[contains(@src,'http://www.zappos.com/images/z/2/4/7/5/9/3/2475933-p-DETAILED.jpg')]")).click();
            driver.findElement(By.linkText("Back to Previous Page")).click();
            driver.findElement(By.linkText("Oxfords")).click();
            driver.findElement(By.cssSelector("img.image-small")).click();
            driver.findElement(By.linkText("Back to Previous Page")).click();
            driver.findElement(By.xpath("//img[contains(@src,'http://www.zappos.com/images/z/2/3/9/0/9/2/2390927-p-DETAILED.jpg')]")).click();
            driver.findElement(By.linkText("Back to Previous Page")).click();
            driver.findElement(By.xpath("//img[contains(@src,'http://www.zappos.com/images/z/2/3/0/0/3/6/2300368-p-DETAILED.jpg')]")).click();
            driver.findElement(By.linkText("Back to Previous Page")).click();
            driver.findElement(By.xpath("//img[contains(@src,'http://www.zappos.com/images/z/1/8/8/0/1/5/1880151-p-DETAILED.jpg')]")).click();
            driver.findElement(By.linkText("Back to Previous Page")).click();
            driver.findElement(By.xpath("//img[contains(@src,'http://www.zappos.com/images/z/2/3/9/0/9/2/2390925-p-DETAILED.jpg')]")).click();
            driver.findElement(By.linkText("Back to Previous Page")).click();
            driver.findElement(By.xpath("//img[contains(@src,'http://www.zappos.com/images/z/2/6/6/1/4/4/2661447-p-DETAILED.jpg')]")).click();
            driver.findElement(By.linkText("Back to Previous Page")).click();
            driver.findElement(By.linkText("Sandals")).click();
            driver.findElement(By.cssSelector("img.image-small")).click();
            new Select(driver.findElement(By.name("variant_id"))).selectByVisibleText("Light Brown");
            driver.findElement(By.linkText("Back to Previous Page")).click();
            driver.findElement(By.xpath("//img[contains(@src,'http://www.zappos.com/images/z/1/5/5/8/0/5/1558057-p-DETAILED.jpg')]")).click();
            driver.findElement(By.linkText("Back to Previous Page")).click();
            driver.findElement(By.xpath("//img[contains(@src,'http://www.zappos.com/images/z/2/5/1/3/7/3/2513738-p-DETAILED.jpg')]")).click();
            driver.findElement(By.linkText("Back to Previous Page")).click();
            driver.findElement(By.xpath("//img[contains(@src,'http://www.zappos.com/images/z/2/1/2/7/3/9/2127398-p-DETAILED.jpg')]")).click();
            driver.findElement(By.linkText("Back to Previous Page")).click();
            driver.findElement(By.xpath("//img[contains(@src,'http://www.zappos.com/images/z/2/6/1/0/0/9/2610095-p-DETAILED.jpg')]")).click();
            driver.findElement(By.linkText("Back to Previous Page")).click();
            driver.findElement(By.xpath("//img[contains(@src,'http://www.zappos.com/images/z/2/2/3/8/2/8/2238287-p-DETAILED.jpg')]")).click();
            driver.findElement(By.linkText("Back to Previous Page")).click();
            driver.findElement(By.linkText("Snowboarding")).click();
            driver.findElement(By.cssSelector("img.image-small")).click();
            driver.findElement(By.linkText("Back to Previous Page")).click();
            driver.findElement(By.xpath("//img[contains(@src,'http://www.zappos.com/images/z/2/3/1/7/9/5/2317951-p-DETAILED.jpg')]")).click();
            driver.findElement(By.linkText("Back to Previous Page")).click();
            driver.findElement(By.xpath("//img[contains(@src,'http://www.zappos.com/images/z/2/3/1/7/9/5/2317953-p-DETAILED.jpg')]")).click();
            driver.findElement(By.linkText("Back to Previous Page")).click();
            driver.findElement(By.xpath("//img[contains(@src,'http://www.zappos.com/images/z/2/3/1/0/6/3/2310639-p-DETAILED.jpg')]")).click();
            driver.findElement(By.linkText("Back to Previous Page")).click();
            driver.findElement(By.xpath("//img[contains(@src,'http://www.zappos.com/images/z/1/9/0/2/0/5/1902057-p-DETAILED.jpg')]")).click();
            driver.findElement(By.linkText("Back to Previous Page")).click();
            driver.findElement(By.xpath("//img[contains(@src,'http://www.zappos.com/images/z/2/2/7/1/7/8/2271786-p-DETAILED.jpg')]")).click();
            driver.findElement(By.linkText("Back to Previous Page")).click();
            driver.findElement(By.xpath("//img[contains(@src,'http://www.zappos.com/images/z/2/3/2/0/9/1/2320913-p-DETAILED.jpg')]")).click();
            driver.findElement(By.linkText("Back to Previous Page")).click();
            driver.findElement(By.linkText("Slippers")).click();
            driver.findElement(By.cssSelector("img.image-small")).click();
            driver.findElement(By.linkText("Back to Previous Page")).click();
            driver.findElement(By.xpath("//img[contains(@src,'http://www.zappos.com/images/z/1/1/7/0/1/4/1170149-p-DETAILED.jpg')]")).click();
            driver.findElement(By.linkText("Back to Previous Page")).click();
            driver.findElement(By.xpath("//img[contains(@src,'http://www.zappos.com/images/z/2/3/6/9/7/0/2369706-p-DETAILED.jpg')]")).click();
            driver.findElement(By.linkText("Back to Previous Page")).click();
            driver.findElement(By.xpath("//img[contains(@src,'http://www.zappos.com/images/z/2/8/7/5/7/1/287571-p-DETAILED.jpg')]")).click();
            driver.findElement(By.linkText("Back to Previous Page")).click();
            driver.findElement(By.xpath("//img[contains(@src,'http://www.zappos.com/images/732/7329251/7769-440855-t.jpg')]")).click();
            driver.findElement(By.linkText("Back to Previous Page")).click();
            driver.findElement(By.xpath("//img[contains(@src,'http://www.zappos.com/images/z/9/7/2/9720-p-DETAILED.jpg')]")).click();
            driver.findElement(By.linkText("Back to Previous Page")).click();
            driver.findElement(By.xpath("//img[contains(@src,'http://www.zappos.com/images/z/6/6/7/1/1/5/667115-p-DETAILED.jpg')]")).click();
            driver.findElement(By.linkText("Back to Previous Page")).click();
            driver.findElement(By.xpath("//img[contains(@src,'http://www.zappos.com/images/z/3/6/0/36061-p-DETAILED.jpg')]")).click();
            driver.findElement(By.linkText("Back to Previous Page")).click();


          }

          @After
          public void tearDown() throws Exception {
            driver.quit();
            String verificationErrorString = verificationErrors.toString();
            if (!"".equals(verificationErrorString)) {
              fail(verificationErrorString);
            }
          }

          private boolean isElementPresent(By by) {
            try {
              driver.findElement(by);
              return true;
            } catch (NoSuchElementException e) {
              return false;
            }
          }

          private boolean isAlertPresent() {
            try {
              driver.switchTo().alert();
              return true;
            } catch (NoAlertPresentException e) {
              return false;
            }
          }

          private String closeAlertAndGetItsText() {
            try {
              Alert alert = driver.switchTo().alert();
              String alertText = alert.getText();
              if (acceptNextAlert) {
                alert.accept();
              } else {
                alert.dismiss();
              }
              return alertText;
            } finally {
              acceptNextAlert = true;
            }
          }
        }

我甚至使用过Thread.sleep,但它仍然失败了。我正在使用'selenium Ide 2.5.0'和'selenium-2.41.0'jar文件和Firefox 28.0。运行时会出现此错误。请告诉我在代码中添加额外内容以使其正常运行。

       org.openqa.selenium.NoSuchElementException: Unable to locate element: {"method":"xpath","selector":"//img[contains(@src,'http://www.zappos.com/images/z/2/5/5/4/8/0/2554809-p-DETAILED.jpg')]"}
Command duration or timeout: 31.78 seconds
For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
Build info: version: '2.41.0', revision: '3192d8a', time: '2014-03-27 17:18:15'
System info: host: 'hp', ip: '192.168.1.103', os.name: 'Windows 8', os.arch: 'amd64', os.version: '6.2', java.version: '1.7.0_45'
Session ID: d9828113-feb8-4959-87ab-8a8e920a219b
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities [{platform=XP, acceptSslCerts=true, javascriptEnabled=true, cssSelectorsEnabled=true, databaseEnabled=true, browserName=firefox, handlesAlerts=true, browserConnectionEnabled=true, webStorageEnabled=true, nativeEvents=true, rotatable=false, locationContextEnabled=true, applicationCacheEnabled=true, takesScreenshot=true, version=28.0}]
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:193)
    at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:145)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:595)
    at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:348)
    at org.openqa.selenium.remote.RemoteWebDriver.findElementByXPath(RemoteWebDriver.java:445)
    at org.openqa.selenium.By$ByXPath.findElement(By.java:357)
    at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:340)
    at kids_select.Kids_selection.testUntitled(Kids_selection.java:44)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: org.openqa.selenium.remote.ErrorHandler$UnknownServerException: Unable to locate element: {"method":"xpath","selector":"//img[contains(@src,'http://www.zappos.com/images/z/2/5/5/4/8/0/2554809-p-DETAILED.jpg')]"}
Build info: version: '2.41.0', revision: '3192d8a', time: '2014-03-27 17:18:15'
System info: host: 'hp', ip: '192.168.1.103', os.name: 'Windows 8', os.arch: 'amd64', os.version: '6.2', java.version: '1.7.0_45'
Driver info: driver.version: unknown
    at <anonymous class>.FirefoxDriver.prototype.findElementInternal_(file:///C:/Users/n207tu/AppData/Local/Temp/anonymous1446138331564365903webdriver-profile/extensions/fxdriver@googlecode.com/components/driver_component.js:8905)
    at <anonymous class>.fxdriver.Timer.prototype.setTimeout/<.notify(file:///C:/Users/n207tu/AppData/Local/Temp/anonymous1446138331564365903webdriver-profile/extensions/fxdriver@googlecode.com/components/driver_component.js:396)

0 个答案:

没有答案