无法单击硒中的按钮

时间:2020-09-01 05:47:23

标签: python-3.x selenium selenium-webdriver

我试图单击下面的三个按钮中的任何一个,但是找不到名称,ID或类别来标识

有任何提示吗?

<user-tile-actions ng-transclude="actions"> <!----><button ng-if="!vm.user.isBlockingMe         
&amp;&amp; !vm.user.isBlocked" type="button" class="button-height-32 button-padding-10 follow-icon         
button-scs button-scs-shadow" user-follow="vm.user" event-label="user-tile-small"><i class="icon- 
person-plus"></i></button><!----> </user-tile-actions>

<button ng-if="!vm.user.isBlockingMe &amp;&amp; !vm.user.isBlocked" type="button" class="button- 
height-32 button-padding-10 follow-icon button-scs button-scs-shadow" user-follow="vm.user" event- 
label="user-tile-small"><i class="icon-person-plus"></i></button>

<i class="icon-person-plus"></i>

我收到消息:否这样的元素:无法找到元素:消息: {“方法”:“ css选择器”,“选择器”:“。button-height-32 button-padding-10 follow-icon button-scs button-scs-shadow”}

enter image description here

2 个答案:

答案 0 :(得分:1)

您尝试过

driver.find_element_by_xpath("//button[@event-label='user-tile-small']").click()

答案 1 :(得分:1)

如果它不在iframe或其他任何东西中,这也应该起作用。

driver.find_element_by_class_name("button-scs-shadow").click()