Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/apache-kafka/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
提交按钮在Selenium webdriver中不起作用_Selenium_Selenium Webdriver_Selenium Chromedriver - Fatal编程技术网

提交按钮在Selenium webdriver中不起作用

提交按钮在Selenium webdriver中不起作用,selenium,selenium-webdriver,selenium-chromedriver,Selenium,Selenium Webdriver,Selenium Chromedriver,当我启动ChromeDriver或IEDriver并单击submit按钮(手动和自动)时,它不会发送输入。它在webdriver之外工作,我可以单击submit按钮并发送输入,但在webdriver中,它似乎什么都不做。webdriver有什么问题吗 谢谢 注:selenium版本是最新的2.47.0以及chrome和chromedriver。我无法提供该网页的链接,因为它是一个私有服务器。这是按钮的代码 <span id="button-1429-btnInnerEl" class="x

当我启动ChromeDriver或IEDriver并单击submit按钮(手动和自动)时,它不会发送输入。它在webdriver之外工作,我可以单击submit按钮并发送输入,但在webdriver中,它似乎什么都不做。webdriver有什么问题吗

谢谢


注:selenium版本是最新的2.47.0以及chrome和chromedriver。我无法提供该网页的链接,因为它是一个私有服务器。这是按钮的代码

<span id="button-1429-btnInnerEl" class="x-btn-inner x-btn-inner-center" unselectable="on">Submit All</span>
提交所有
尝试使用javaScript单击它:


有同样的问题。使用
element.sendKeys(Keys.ENTER)
可以为我解决此问题。

您可以尝试以下方法:-

driver.findElement(By.xpath("//*[contains(text(),'Submit All')]")).click();

它会解决的,这里我用的是python语言。 首先,您需要导入密钥,下面的代码将帮助您

from selenium.webdriver.common.keys import Keys
login_btn=driver.find_element_by_id('button-1429-btnInnerEl').send_keys(Keys.ENTER)
解决方案:-

步骤1。
导入org.openqa.selenium.Keys


第2步。
驱动程序.element.sendKeys(Keys.ENTER)

您可以使用Action类。可能是按钮显示错误

IWebElement button = driver.FindElement(By.Id("submit")); // locate the button
Actions action = new Actions(driver);
action.MoveToElement(button).Click().Perform(); 

您是否可以添加更多详细信息,如selenium version.ie版本、chromeversion、iedriverserver版本、chromedriver版本,以及是否可以提供网页链接或按钮的html代码。selenium版本是最新的2.47.0以及chrome和chromedriver。我无法提供该网页的链接,因为它是一个私有服务器。这是按钮的代码…全部提交。。感谢您使用sencha extjs应用程序。如果是,您使用的是哪个版本的extjs选择器[xpath],我们使用的是extjs 4,我使用的是//span[text()='Submit All'],我尝试过,但对我无效。谢谢你得到了什么异常?没有异常,测试通过了,但实际上没有提交任何东西。当我查看测试时,我可以清楚地看到selenium与按钮交互,但它实际上没有提交任何内容。您是否检查了元素并在搜索框中键入“全部提交”,以再次检查是否只有一个元素具有该文本。因为如果不是,那可能是按钮没有被点击的原因之一?我在控制台中使用xpath搜索时只看到元素显示的一个。不过这一点很好。我认为这可能与extjs 4有关?请您添加适当的解释以便更好地理解我使用了定制的xpath,它找到了一个包含文本“全部提交”的元素,然后单击它。如果您想要id或名称为xpath,请共享按钮的代码,该按钮肯定以或标记开头。
IWebElement button = driver.FindElement(By.Id("submit")); // locate the button
Actions action = new Actions(driver);
action.MoveToElement(button).Click().Perform();