简体   繁体   中英

How to use Selenium to interact with javascript in python?

First I use python and selenium to load a website in firefox. Then I fill in a simple javascript type form. The site is poorly made but usually if I tell selenium to use (Keys.RETURN) then it will drop down a list of options. The problem is I don't know how to click on one of these because they didn't load with the web page. I tried using (Keys.ARROW_DOWN) to go through them but it still doesn't really work.

How can I interact with javascript through selenium using python?

Thanks.

PS I know almost nothing about javascript so if there is some way to do it, I still would be clueless on how to use javascript anyway...

You might have to tell the browser to wait for a few milliseconds.

Some places to look:

Clicking on a Javascript Link on Firefox with Selenium

http://seleniumhq.org/docs/04_webdriver_advanced.jsp

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM