[英]Unable to click or sendKeys in ajax overlay popup coming and its showing Element not Intractable exception using selenium and java
I have been practicing to automate few scenarios for web application way2Automation.com and struggling to enter the text in Registration form coming as the popup.我一直在练习为 web 应用程序 way2Automation.com 自动化一些场景,并努力在弹出的注册表单中输入文本。 I have done some research already and tried many ways mentioned below:
我已经做了一些研究,并尝试了下面提到的许多方法:
a) Using WebDriverWait and explicit wait b) Using Implicit wait and Thread.sleep c) Using JavaScriptExecutor a) 使用 WebDriverWait 和显式等待 b) 使用隐式等待和 Thread.sleep c) 使用 JavaScriptExecutor
But none of them worked for me and I am still stuck to register the user.但他们都没有为我工作,我仍然坚持注册用户。 Would really appreciate the help.
非常感谢您的帮助。 Below are the artificats
下面是神器
URL: http://way2automation.com/way2auto_jquery/index.php URL: http://way2automation.com/way2auto_jquery/index.php
Code trials:代码试验:
1) 1)
// WebElement ele = driver.findElement(By.xpath("//*[@id='load_form']/div/div[2]/input"));
// JavascriptExecutor executor = (JavascriptExecutor)driver;
// executor.executeScript("arguments[0].click();", ele);
// WebElement button = driver.findElement(By.xpath("//*[@id=\"load_form\"]/div/div[2]/input"));
// new WebDriverWait(driver, 10).until(ExpectedConditions.visibilityOf(button));
To click on SUBMIT you can use either of the following Locator Strategies :要单击提交,您可以使用以下任一定位器策略:
cssSelector
: cssSelector
:
driver.findElement(By.cssSelector("input.button[value='Submit']")).click();
xpath
: xpath
:
driver.findElement(By.xpath("//input[@class='button' and @value='Submit']")).click();
However, as the element is a dynamic element so to click()
on the element you need to induce WebDriverWait for the elementToBeClickable()
and you can use either of the following Locator Strategies :但是,由于元素是动态元素,因此要在元素上
click()
,您需要为elementToBeClickable()
诱导WebDriverWait ,并且您可以使用以下任一定位器策略:
cssSelector
: cssSelector
:
new WebDriverWait(driver, 20).until(ExpectedConditions.elementToBeClickable(By.cssSelector("input.button[value='Submit']"))).click();
xpath
: xpath
:
new WebDriverWait(driver, 20).until(ExpectedConditions.elementToBeClickable(By.xpath("//input[@class='button' and @value='Submit']"))).click();
You can find a detailed discussion on NoSuchElementException in:您可以在以下位置找到关于NoSuchElementException的详细讨论:
You need to handle windows
Try the below code and let me know updates
driver.get("http://way2automation.com/way2auto_jquery/index.php");
String parent=driver.getWindowHandle();
String child=driver.getWindowHandle();
driver).switchTo().window(child);
driver.findElement(By.name("name")).sendKeys("Abhishek Saxena");
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.