简体   繁体   English

Selenium RC python,使用find_element_by_link_text

[英]selenium RC python, using find_element_by_link_text

I have the following HTML element which I am trying to find through find_element_by_link_text 我有以下HTML元素,我正在尝试通过find_element_by_link_text查找

<A href="/help/index.html?sys_optimization_community.html" target="_blank"><IMG src="/images/help.gif" border="0" alt="Help" hspace="3"></A>

As you can see there is no link text. 如您所见,没有链接文本。 Can I used find_element_by_link_text or is there any other API with selenium python library that I can use. 我可以使用find_element_by_link_text还是可以使用带硒Python库的任何其他API。 Please help. 请帮忙。

You cannot use find_element_by_link_text. 您不能使用find_element_by_link_text。 You have 3 options. 您有3个选择。

  1. If you have control over html add an id and get it by id. 如果您可以控制html,请添加一个ID并通过ID获取它。
  2. Get all links in the page and use the one with specified link (href value). 获取页面中的所有链接,并使用具有指定链接(href值)的链接。
  3. Best way: Use xpath. 最佳方法:使用xpath。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM