我试图用Chrome webdriver点击元素,但我无法找出点击它的方法。
该页面显示我在登录后,所以我不能发布的网站URL
元素的HTML代码是:找不到点击Chrome webdriver中元素的方法 - Selenium
<gf-dashboard-card class="ng-scope ng-isolate-scope" href="/chat">
<div class="card">
<div class="card-icon">
<i class="card-icon material-icons ng-
binding">question_answer</i>
</div>
<span style="text-
overflow:ellipsis;white-space:nowrap;overflow:hidden"
class="md-subhead ng-binding">Conversations</span>
</div>
</gf-dashboard-card>
我试过任何方式,我不能想点击的元素但我总是不断收到错误:
Message: no such element: Unable to locate element
元素的XPath是
//*[@id="dashboard-cards"]/gf-dashboard-card[1]
哪给了我什么。
一个有趣的事情是,在Firefox的webdriver我可以
driver.find_element_by_class_name("ng-isolate-scope").click()
点击它,但它是无法与Chrome工作。
我可以
$('.md-subhead').click();
通过控制台点击元素,但还没有想出如何通过Selenium运行此。
任何想法如何我可以运行它?
尝试'driver.find_element_by_css_selector(“span.md-小标题”)' – Mangohero1
调试代码时,看到问题是造成前点击添加一个长时间的睡眠页面未完成加载。 – yong