简体   繁体   English

无法单击或发送 ajax 覆盖弹出窗口中的键或使用 selenium 和 java 显示 Element not Intractable 异常

[英]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

方式2自动化

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();

Reference参考

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.

相关问题 Java selenium 无法发送键和单击元素 - Java selenium can't sendkeys and click element 没有这样的元素:无法找到元素:硒中出现异常 - No such element: Unable to locate element: exception coming in selenium 无法在 google 登录弹出窗口中发送密钥/键入电子邮件 [JAVA - selenium] - Unable to sendkeys/type email in google login popup window [ JAVA - selenium ] 无法在 Java 中使用 Selenium 单击 Web 元素 - Unable to click on Web Element using Selenium with Java Java Selenium 使用 sendKeys 打开多个选项卡时出现“元素不可交互异常” - Java Selenium "Element Not Interactable Exception" when using sendKeys to open multiple tabs 无法模态弹出关闭链接不能使用Java单击硒? - Unable to Modal popup close link not click in selenium using java? Selenium + Java。 click或sendKeys无法与通过循环接收的元素一起使用 - Selenium+Java. click or sendKeys not working with element received via cycle 没有元素硒的Sendkeys Java - Sendkeys without element selenium java 无法使用Java在Selenium Webdriver中单击弹出按钮 - Unable to click on a popup button in selenium webdriver with java 无法使用 Selenium Java 中的 sendKeys() 将文件上传到“浏览”按钮 - Unable to upload a file to the "browse" button using sendKeys() in Selenium Java
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM