Selenium WebDriver Yahoo邮件注销错误
我是SeleniumWebDriver的新手,我正在尝试编写一个简单的脚本来登录到yahoo电子邮件帐户,然后注销。我已经设法让登录部分工作,但我还不能让注销部分工作。我得到以下错误:Selenium WebDriver Yahoo邮件注销错误,selenium,selenium-webdriver,Selenium,Selenium Webdriver,我是SeleniumWebDriver的新手,我正在尝试编写一个简单的脚本来登录到yahoo电子邮件帐户,然后注销。我已经设法让登录部分工作,但我还不能让注销部分工作。我得到以下错误: Exception in thread "main" org.openqa.selenium.NoSuchElementException: Unable to locate element: {"method":"link text","selector":"Sign Out"} 到目前为止,我已经尝试了以下
Exception in thread "main" org.openqa.selenium.NoSuchElementException: Unable to locate
element: {"method":"link text","selector":"Sign Out"}
到目前为止,我已经尝试了以下三种方法:
(一)
(二)
(三)
在每种情况下,我基本上都会得到相同的错误。我已将代码粘贴到下面。任何帮助都将不胜感激
FirefoxDriver driver = new FirefoxDriver();
driver.get("https://login.yahoo.com/config/login_verify2?.intl=ca&.src=ym");
driver.manage().window().maximize();
WebElement element = driver.findElement(By.id("username"));
element.sendKeys("myid@yahoo.com");
driver.findElement(By.id("passwd")).sendKeys("mypassword");
element.submit();
Thread.sleep(40000);
driver.findElement(By.linkText("Sign Out")).click();
Thread.sleep(40);
使用下面的脚本,它将工作:
Actions actions = new Actions(driver);
WebElement m1 = driver.findElement(By.linkText("Sign out"));
actions.moveToElement(m1);
actions.click().build().perform();
使用下面的脚本,它将工作:
Actions actions = new Actions(driver);
WebElement m1 = driver.findElement(By.linkText("Sign out"));
actions.moveToElement(m1);
actions.click().build().perform();
使用下面的脚本,它将工作:
Actions actions = new Actions(driver);
WebElement m1 = driver.findElement(By.linkText("Sign out"));
actions.moveToElement(m1);
actions.click().build().perform();
使用下面的脚本,它将工作:
Actions actions = new Actions(driver);
WebElement m1 = driver.findElement(By.linkText("Sign out"));
actions.moveToElement(m1);
actions.click().build().perform();
用户是否成功登录,您是否看到注销链接?您还可以共享注销链接元素的HTML代码吗?用户是否成功登录,您是否看到注销链接?您还可以共享注销链接元素的HTML代码吗?用户是否成功登录,您是否看到注销链接?您还可以共享注销链接元素的HTML代码吗?用户是否成功登录,您是否看到注销链接?您还可以共享注销链接元素的HTML代码吗?
Actions actions = new Actions(driver);
WebElement m1 = driver.findElement(By.linkText("Sign out"));
actions.moveToElement(m1);
actions.click().build().perform();