如何使用硒网络驱动程序选择包


public class chrome {
public static void main(String[] args) throws InterruptedException {
System.setProperty("webdriver.chrome.driver", "C:\chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.get("https://neontv.co.nz");
Thread.sleep(2000);
driver.findElement(
By.xpath("//*[@class='nv-nav-freetrial-2 nv-nav-item']"))
.click();
Thread.sleep(200);
driver.findElement(
By.xpath("//ul[@id='yui_patched_v3_11_0_2_1529643447183_22']"))
.click();
Thread.sleep(2000);
driver.quit();
}

}

我无法在下一页上选择包。我尝试更改 xpath,但它没有帮助。有没有其他方法可以选择它。任何人都可以帮忙吗

使用操作类,我能够解决这个问题

driver.switchTo().defaultContent();
Actions action = new Actions(driver);
action.moveToElement(btnEnjoy).click().build().perform();

相关内容

最新更新