Python 2.7 无法单击<;i>;要素我正在使用Firefox驱动程序
我尝试了Python 2.7 无法单击<;i>;要素我正在使用Firefox驱动程序,python-2.7,selenium,selenium-webdriver,Python 2.7,Selenium,Selenium Webdriver,我尝试了click()、发送密钥(key.RETURN)、发送密钥(key.ENTER)、发送密钥(“\n”)。它不起作用。有人能帮忙吗 <thead> <tr> <th></th> <th> <div class="th-floater"></div> <i class="icon-chevron-up clickable th-floater">&
click()、发送密钥(key.RETURN)、发送密钥(key.ENTER)、发送密钥(“\n”)
。它不起作用。有人能帮忙吗
<thead>
<tr>
<th></th>
<th>
<div class="th-floater"></div>
<i class="icon-chevron-up clickable th-floater"></i>
<i class="icon-chevron-down clickable th-floater"></i>
</th>
<th></th>
.
.
.
</thead>
我不知道这是怎么解决的。但我想这是Win 7 professional的一些问题。
我从头重新安装了Python和selenium,但单击仍然不起作用。我在另一台Win 7专业机器上也复制了这个 在感到沮丧之后,我在windows服务器上安装了Python和selenium。单击开始工作:)尝试以下操作:
i_ele = driver.find_element_by_xpath('//i[@class="icon-chevron-up clickable th-floater"]')
我对xpath不太熟悉,但是
“//thead//tr//th[2]//I[@class='icon-chevron-up clickable th flotter']”
是否更正确?是的,我也可以使用它。但是,它能够使用currnet xpath表达式正确标识元素。我使用了print I_ele.get_属性(“类”)打印类名,并使用print I_ele.tag_名称打印标记名。它打印正确。混乱是为什么它不能点击元素?我会非常感谢你在这方面的帮助。我完全被封锁了!尝试执行。单击()
,是否看到任何类型的异常?看看您的try/except,您不会看到Webdriver将抛出的异常。请在不使用Try/except的情况下尝试,并让我们知道您看到的异常。您是否尝试过i[contains(@class,'icon-chevron-up clickable th flotter')?我过去曾与@class='xxx'发生过一些问题
i_ele = driver.find_element_by_xpath('//i[@class="icon-chevron-up clickable th-floater"]')