【发布时间】:2018-02-06 09:19:01
【问题描述】:
<button aria-label="Connect with ABC" class="search-result__actions--primary button-secondary-medium m5" data-ember-action="" data-ember-action-1510="1510">Connect</button>
<button aria-label="Connect with DEF" class="search-result__actions--primary button-secondary-medium m5" data-ember-action="" data-ember-action-1467="1467">Invite Sent !</button>
我正在尝试使用
查找带有文本“连接”的按钮connect_buttons = firefox.find_elements_by_link_text ('Connect')
但是firefox找不到按钮。
即使我尝试过使用以下模式,但是
firefox.find_elements_by_xpath("//*[contains(text(), 'Connect')]")
# Not accurate results
firefox.find_elements_by_css_selector('.search-result__actions--primary.button-secondary-medium.m5');
# return all button with same css even which doesn't have text "Connect".
请提出建议。
【问题讨论】:
-
感谢 Vadim 格式化我的问题。 :)
-
元素是否在 IFRAME 中?
标签: python python-3.x firefox selenium-webdriver