[英]How to click button inside html inside #document using selenium in python?
<html>
<frame src="/mts.web/Menu_big5.aspx" name="leftFrame2" scrolling="no" noresize="">
#document
<!doctype html PUBLIC "-//W3C//DTD MTML 4.01 Transtitional//EN">
<html>
<Head></Head>
<Body>
<table>
<tbody>
<tr>
<td>
<a href="javascript:inputOrder('B')" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image2','','images/btn/buy_on_b5.gif',1)">
<img src="https://bss2.bsgroup.com.hk/mts.web/images/btn/buy_b5.gif" name="Image2" width="92" height="20" border="0">
</a>
</td>
</tr>
</tbody>
</table>
</Body>
</html>
</frame>
</html>
如何使用driver.find_element_by
单击<td>...</td>
内的按钮
我尝试使用 chrome 复制我上面所说的按钮的 xpath 并使用driver.find_element_by_xpath
运行它,但在我将它放入 score 后没有任何操作。
如果有人知道怎么做,请教我。
尝试这个:
driver.switch_to.frame(driver.find_element_by_name("leftFrame2"))
#Now Execute Your code Here
#After that add this line
driver.switch_to.default_content()
对于框架,您需要打开它然后切换回来
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.