登录到gmail后,我无法自动点击Google Apps菜单项

时间:2020-09-09 16:20:06

标签: java python html selenium gmail

我可以使用Selenium打开Goog​​le Apps菜单,但无法单击菜单项: google apps

//Clicks on google apps link
WebDriverWait wait = new WebDriverWait(driver, 10);
wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("path")));
driver.findElement(By.cssSelector("path")).click();

//Click on menu Item
WebDriverWait wait = new WebDriverWait(driver, 10);
wait.until(ExpectedConditions.visibilityOfElementLocated(By.Link("Gmail")));
driver.findElement(By.cssSelector("Gmail")).click();

1 个答案:

答案 0 :(得分:0)

您尝试过吗:

gmail_button = driver.find_element_by_xpath('xpath-of-google-button')
gmail_button.click()

我认为它可以工作。我认为,通过xpath查找元素是刮取网络的最精确工具。 :)