无法在Selenium Webdriver中切换到框架

时间:2018-12-04 10:05:54

标签: selenium-webdriver

[无法切换到相框]
我正在尝试使Web应用程序自动化:-> http://automationpractice.com/index.php

在自动执行时,iam无法切换到窗口框架并输入“数量”。这是下面相同的代码:-

System.setProperty(“ webdriver.chrome.driver”,“ D:\ Automation files \ chromedriver_win32 \ chromedriver.exe”);

WebDriver d =新的ChromeDriver();

d.get(“ http://automationpractice.com/”);

d.manage()。window()。maximize(); d.findElement(By.xpath(“ // * [@ id = \” homefeatured \“] / li2 / div / div2 / div / a2 / img”))。click();

d.switchTo()。frame(“ fancybox-frame1543840385885”);

WebDriverWait w =新的WebDriverWait(d,30);

WebElement ele = w.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(“ // * [@ id = \” quantity_wanted \“]”))))); ele.sendKeys(“ 3”);

0 个答案:

没有答案