【发布时间】:2016-08-05 11:10:20
【问题描述】:
我正在尝试单击navbar 中的链接以触发第三方身份验证模式,我需要对其进行测试。我之前有一些关于如何获取和点击硒的帮助,在此之前一切都很好。
这是我要点击的链接
<li class="pull-right hidden-xs hidden-sm" id="showlogin"><a href="#"><button type="button" class="btn btn-sm btn-info round">GET STARTED</button></a></li>
我的测试结构是:
def test_live_societe_login_using_third_party_modal(self):
"""TODO: Docstring for test_live_societe_login_third_party_modal.
:returns: return modal for third party authentication
"""
WebDriverWait(self.browser, 10).until(lambda browser:
self.browser.find_element_by_id
('showlogin')).click()
self.assertIn('http://societe.herokuapp.com/contact', self.browser.current_url)
我能够测试所有应用程序页面,但点击这个我得到了selenium.common.exceptions.ElementNotVisibleException: Message: Element is not currently visible and so may not be interacted with 异常。有点迷茫,谁能帮帮我,谢谢。
【问题讨论】:
-
Selenium 不允许您单击隐藏元素。您可以像这个问题一样使用 javascript 进行点击操作:stackoverflow.com/questions/12040615/…
-
对不起,回复晚了,我想我知道出了什么问题,稍后再回答,不过谢谢。
标签: django python-3.x selenium django-testing