擅长:python、mysql、java
<p>我用java做了同样的测试。你可能想看看你的错误。在</p>
<pre><code>// Creates a driver object for firefox
WebDriver driver_xpath = new FirefoxDriver();
// Goto page
driver_xpath.get(Address);
// email box >email address >click
driver_xpath.findElement(By.xpath(".//*[@id='email']")).sendKeys(UserID);
// password box >password >click
driver_xpath.findElement(By.xpath(".//*[@id='pass']")).sendKeys(Password);
// login button >click
driver_xpath.findElement(By.xpath(".//*[@id='loginbutton']")).click();
// Navigation drop button >click
driver_xpath.findElement(By.xpath(".//*[@id='userNavigationLabel']")).click();
//Waits for the drop down menu to show
driver_xpath.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
// logout button >click
driver_xpath.findElement(By.xpath("//li[12]/a/span/span")).click();
//Close
driver_xpath.close();
</code></pre>