selenium PhantomJS send_keys doesn't work

烈酒焚心 提交于 2019-12-04 08:03:08

I highly suspect it's just timing issue.

Selenium's click() will wait for page to load if it is redirected after clicking, while send_key() doesn't wait. (PhantomJS is headless, which is faster than Firefox)

Please try add some sleep like time.sleep(5) after elem.send_keys(Keys.RETURN), before print driver.title, and see if you can get the result you want.

In real testing project, you just need to use WebDriverWait until driver.title equals to the value you want.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!