how to open pop up window table using selenium webdriver?

六眼飞鱼酱① 提交于 2019-12-13 04:15:53

问题


there is text label on a webpage, and I am trying to click on that to open a pop-up window,but not getting opened. here is the HTML code:

<td width="40%">
  <div id="EmpId.outline">
    <input type="hidden" name="EmpId" value="" id="popupEmpId">
    <input type="text" name="EmpCode" value="" readonly="readonly" class="textMedium250" id="popupEmpCode" autocomplete="off">&nbsp;<a href="#f2"><label  onclick="checkForPopup('EmpPopupDiv','Select a Emp',640,true,refreshConditionOptions);">&nbsp;+&nbsp;Search&nbsp;for&nbsp;a&nbsp;Emp</label> </a>
 </div>
</td>

I have to click on the label + Search for a Emp, but could not do that.


回答1:


Try to find element by xpath and click. Based on your example, the xpath to find/click should be something like this:

"//a[@href='#f2']"



回答2:


<td width="40%">
  <div id="EmpId.outline">
    <input type="hidden" name="EmpId" value="" id="popupEmpId">
    <input type="text" name="EmpCode" value="" readonly="readonly" class="textMedium250" id="popupEmpCode" autocomplete="off">&nbsp;<a href="#f2" onclick="checkForPopup('EmpPopupDiv','Select a Emp',640,true,refreshConditionOptions);"><label  >&nbsp;+&nbsp;Search&nbsp;for&nbsp;a&nbsp;Emp</label> </a>
 </div>
</td>


来源:https://stackoverflow.com/questions/14257012/how-to-open-pop-up-window-table-using-selenium-webdriver

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!