I am trying to figure out how to activate/click on a feature using python. Like it goes to a page and click on a certain button. How can I do this? Are there any modules that may help?
Advertisement
Answer
Try using the selenium package in Python.
Once you pip install selenium
and download chromedriver, you should be able to use something like this –
from selenium import webdriver url = "your_url" chrome_options = webdriver.ChromeOptions() driver = webdriver.Chrome("/path/to/chromedriver", chrome_options=chrome_options) driver.delete_all_cookies() driver.get(url)
And after your page opens, you’ll first have to find the element using inspect and then based on its name/id/class/etc, you can click on it using –
driver.find_element_by_name('<element_name>').click()