无法单击iframe窗口中的按钮,但在调试时获得成功
无法单击iframe窗口中的按钮元素,但在调试时获得成功。 调试时,我成功地通过了操作。两次(调试和执行)UI(应用程序)都无法看到执行的任何操作 谁能推荐这个吗。我尝试过使用给予等待。按钮的Xpath不能出错,因为在调试时已成功通过 可能是浏览器问题还是什么?我正在使用firefox浏览器无法单击iframe窗口中的按钮,但在调试时获得成功,iframe,xpath,selenium-webdriver,selenium-firefoxdriver,Iframe,Xpath,Selenium Webdriver,Selenium Firefoxdriver,无法单击iframe窗口中的按钮元素,但在调试时获得成功。 调试时,我成功地通过了操作。两次(调试和执行)UI(应用程序)都无法看到执行的任何操作 谁能推荐这个吗。我尝试过使用给予等待。按钮的Xpath不能出错,因为在调试时已成功通过 可能是浏览器问题还是什么?我正在使用firefox浏览器 waitforelementpresent(locator.login_email); click(locator.login_email); type(locator.login_
waitforelementpresent(locator.login_email);
click(locator.login_email);
type(locator.login_email,email);
click(locator.login_password);
type(locator.login_password,password);
Thread.sleep(5000);
click(locator.login_button); //This button I need to click
基类
public static void click(By by) {
WebDriverWait wait = new WebDriverWait(driver, defaultWaitPeriod);
wait.until(ExpectedConditions.elementToBeClickable(by));
driver.findElement(by).click();
}
public static void type(By by, String type) {
WebDriverWait wait = new WebDriverWait(driver, defaultWaitPeriod);
wait.until(ExpectedConditions.visibilityOfElementLocated(by));
driver.findElement(by).clear();
driver.findElement(by).sendKeys(type);
public By login_email=By.xpath("//input[@placeholder='Email ']");
public By login_password=By.xpath("//input[@placeholder='Password ']");
public By login_button=By.xpath("//form[@class='m-t ng-dirty ng-valid-email ng-valid-parse ng-valid ng-valid-required']//button");
定位器
public static void click(By by) {
WebDriverWait wait = new WebDriverWait(driver, defaultWaitPeriod);
wait.until(ExpectedConditions.elementToBeClickable(by));
driver.findElement(by).click();
}
public static void type(By by, String type) {
WebDriverWait wait = new WebDriverWait(driver, defaultWaitPeriod);
wait.until(ExpectedConditions.visibilityOfElementLocated(by));
driver.findElement(by).clear();
driver.findElement(by).sendKeys(type);
public By login_email=By.xpath("//input[@placeholder='Email ']");
public By login_password=By.xpath("//input[@placeholder='Password ']");
public By login_button=By.xpath("//form[@class='m-t ng-dirty ng-valid-email ng-valid-parse ng-valid ng-valid-required']//button");
您是否尝试切换到该
iframe
?是的,它成功切换并能够执行两个操作扫描您共享您使用的代码?共享代码,使用html源代码的html代码图像链接尝试切换到帧,因为我在您的代码中看不到任何switchTo()语句!也可以使用driver.manage().timeouts().implicitlyWait(10,TimeUnit.SECONDS),而不是为每个元素添加等待条件代码>