我无法通过 Selenium Java 找到按钮
I can't find the button via Selenium Java
我试图通过 cssSelector 和 xPath 找到它,但无论如何显示 NoSuchElementException
WebElement element = driver.findElement(By.cssSelector("button[class='btn btn-primary c-schedule-story-button ']"));
element.click();
Screenshot is here
driver.switchTo().frame(driver.findElement(By.tagName("iframe")));
WebElement element = driver.findElement(By.cssSelector("button..c-schedule-story-button"));
element.click();
它在 iframe 中,你必须先切换到那个
如果你想再次与外部元素交互,你必须切换到默认内容
driver.switchTo().defaultContent()
我试图通过 cssSelector 和 xPath 找到它,但无论如何显示 NoSuchElementException
WebElement element = driver.findElement(By.cssSelector("button[class='btn btn-primary c-schedule-story-button ']"));
element.click();
Screenshot is here
driver.switchTo().frame(driver.findElement(By.tagName("iframe")));
WebElement element = driver.findElement(By.cssSelector("button..c-schedule-story-button"));
element.click();
它在 iframe 中,你必须先切换到那个
如果你想再次与外部元素交互,你必须切换到默认内容
driver.switchTo().defaultContent()