我正在使用 splinter 运行一些浏览器测试,并且在某一时刻,遇到了一个带有我想要关注的链接的页面。此调用成功并返回链接:
my_browser.find_link_by_partial_href('/mystuff/' + str(important_number))
但我不能点击它:
my_browser.find_link_by_partial_href('/mystuff/' + str(important_number)).click()
...
...
...
ElementNotVisibleException: Message: u'{"errorMessage":"Element is not currently visible and may not be manipulated","request":{"headers":{"Accept":"application/json","Accept-Encoding":"identity","Connection":"close","Content-Length":"81","Content-Type":"application/json;charset=UTF-8","Host":"127.0.0.1:38495","User-Agent":"Python-urllib/2.7"},"httpVersion":"1.1","method":"POST","post":"{\\"sessionId\\": \\"7812e810-9100-11e4-881c-37067349397d\\", \\"id\\": \\":wdc:1420039695427\\"}","url":"/click","urlParsed":{"anchor":"","query":"","file":"click","directory":"/","path":"/click","relative":"/click","port":"","host":"","password":"","user":"","userInfo":"","authority":"","protocol":"","source":"/click","queryKey":{},"chunks":["click"]},"urlOriginal":"/session/7812e810-9100-11e4-881c-37067349397d/element/%3Awdc%3A1420039695427/click"}}' ; Screenshot: available via screen
奇怪的是,当我关注时,链接确实存在my_browser.url
以及查看my_browser.html
或尝试时,链接确实存在browser.show_screenshot(my_browser)
。
这似乎不是等待可见性的问题。在单击之前添加快速import time(); time.wait(5);
仍然不起作用(也不再等待,尽管这可能已经足够了)。
我在这里能错过什么?