Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/22.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
如何使用Ruby单击SeleniumWebDriver中的JavaScript元素_Ruby_Selenium Webdriver - Fatal编程技术网

如何使用Ruby单击SeleniumWebDriver中的JavaScript元素

如何使用Ruby单击SeleniumWebDriver中的JavaScript元素,ruby,selenium-webdriver,Ruby,Selenium Webdriver,我想在ruby中使用seleinum web驱动程序单击HeaderAsetName javajscript元素 <th class="headerIconURL" scope="col"> <a href="javascript:__doPostBack(&#39;ctl00$cphMainContent$gvAssets&#39;,&#39;Sort$IconID&#39;)">Type</a> </th>

我想在ruby中使用seleinum web驱动程序单击HeaderAsetName javajscript元素

<th class="headerIconURL" scope="col">
    <a href="javascript:__doPostBack(&#39;ctl00$cphMainContent$gvAssets&#39;,&#39;Sort$IconID&#39;)">Type</a>
</th>
您是否可以请任何人帮助单击使用selenium web驱动程序的元素?
我是否需要对java href元素执行任何特殊操作?

问题可能是CSS选择器单击了th元素。单击事件通常只向上冒泡。这意味着DOM中较低的链接从未意识到应该单击它并触发javascript

请尝试单击该链接:

@driver.find_element(:css,'th.headerIconURL' a).click
@driver.find_element(:css,'th.headerIconURL' a).click