更新时间:2023-10-29 08:08:52
首先存储在对象元件,比方说 element
,然后编写下面的代码点击那个隐藏的元素:
JavascriptExecutor js =(JavascriptExecutor)驱动程序;
js.executeScript(arguments [0] .click();,element);
I have a grid which displays some records. When I click on a record and inspect that element it is shown that it is hidden but it is visible in the grid.
My HTML is:
<a href="http://192.168.1.6/eprint_prod_3.8/settings/othercost_add.aspx?type=edit&id=805" title="Plastic Spiral Bind"
<div style="float: left; width: 99%; overflow: hidden; height: 15px; overflow: hidden"> Plastic Spiral Bind </div>
</a>
The above code is hidden while inspecting but it is visible in grid.
Selenium code:
driver.findElement(By.partialLinkText("Plastic Spiral Bind")).click();
First store that element in object, let's say element
and then write following code to click on that hidden element:
JavascriptExecutor js = (JavascriptExecutor)driver;
js.executeScript("arguments[0].click();", element);