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
Selenium java中的Click()看起来像是;点击";但什么也没发生。在IE浏览器中_Java_Selenium_Internet Explorer - Fatal编程技术网

Selenium java中的Click()看起来像是;点击";但什么也没发生。在IE浏览器中

Selenium java中的Click()看起来像是;点击";但什么也没发生。在IE浏览器中,java,selenium,internet-explorer,Java,Selenium,Internet Explorer,我试图打开一个新的“查找窗口”,它是点击“搜索按钮”的输出。 我正试图用java中的Selenium实现自动化 我尝试过的代码是: scrollToElement(webDriver, elementInput); jsExecuter.executeScript("arguments[0].click();", elementInput); 以及 我正在使用try-catch验证“click”,并且没有抛出异常,这就是我假设它单击的原因。但是查找窗口不显示 elementInput的HTML

我试图打开一个新的“查找窗口”,它是点击“搜索按钮”的输出。 我正试图用java中的Selenium实现自动化

我尝试过的代码是:

scrollToElement(webDriver, elementInput);
jsExecuter.executeScript("arguments[0].click();", elementInput);
以及

我正在使用try-catch验证“click”,并且没有抛出异常,这就是我假设它单击的原因。但是查找窗口不显示

elementInput的HTML为:

<td class="comp-button" onclick="javascript:return getDefaultValue('8','ReaderOneId','ReaderOneName',false,'Reader1');">
                    <a onmouseover="$('#Reader1Img').attr('src','/Content/images/btn_lookup_hover.png');" onmouseout="$('#Reader1Img').attr('src','/Content/images/btn_lookup.png');" href="javascript:void(0);">
                        <input name="Reader1Img" class="image-lookup" id="Reader1Img" style="border: 0px currentColor; border-image: none;" type="image" alt="" src="/Content/images/btn_lookup.png">
                    </a>
                </td>
<a onmouseover="$('#Reader1Img').attr('src','/Content/images/btn_lookup_hover.png');" onmouseout="$('#Reader1Img').attr('src','/Content/images/btn_lookup.png');" href="javascript:void(0);">
                        <input name="Reader1Img" class="image-lookup" id="Reader1Img" style="border: 0px currentColor; border-image: none;" type="image" alt="" src="/Content/images/btn_lookup.png">
                    </a>
<input name="Reader1Img" class="image-lookup" id="Reader1Img" style="border: 0px currentColor; border-image: none;" type="image" alt="" src="/Content/images/btn_lookup.png">

我正在使用访问此图像按钮

By.id(“Reader1Img”)
这是传递给
elementInput的值

我用同样的方法找到元素,然后试着点击它

当我尝试“findElement”时,返回的值不是null,因此它能够找到按钮


我还可以看到“搜索图标”的颜色或图像变为蓝色,但查找不会打开

尝试将功能
nativeEvents
添加为false,以启用Internet explorer浏览器中的单击功能

DesiredCapabilities caps = DesiredCapabilities.internetExplorer(); 
caps.setCapability("nativeEvents",false);
WebDriver driver = new  InternetExplorerDriver(caps);

您能否发布用于查找
elementInput
的代码,以及
elementInput
的HTML?如果选择器或webelement出现问题,这将帮助我们跟踪own。如果
.click()
和Javascript click都不起作用,则可能是选择器单击了您不希望看到的内容。您选择的元素是什么?您确定这是具有单击操作的元素吗?您选择的元素应该具有单击事件,因此请确保您是否尝试过使用F12开发人员工具检查它是否包含一些错误?尝试在按钮单击事件中添加调试器,并检查单击事件是否已执行?您是否可以发布足够的代码以重现中的问题?我尝试设置该功能,但它对我无效。还有其他建议吗?@Christine elementInput只是一个By.id()字符串。它的HTML是,你能在这里发布你的全文吗?我已经编辑了这个问题。请找到我现在试图点击的图片按钮的html。你也可以发布你的时间要求吗?
DesiredCapabilities caps = DesiredCapabilities.internetExplorer(); 
caps.setCapability("nativeEvents",false);
WebDriver driver = new  InternetExplorerDriver(caps);