X
X
xtsax2019-07-28 18:36:37
Python
xtsax, 2019-07-28 18:36:37

How to make button click by Selenium coordinates?

How to make a button click, or rather a checkbox through the coordinates of how many such checkboxes are very many and how to find the necessary coordinates on the mrush.mobi
site itself (you need to press enter several times for the captcha to appear) My code

from selenium import webdriver

driver = webdriver.Chrome(executable_path=r'C:\mrush\chromedriver.exe')
url = "http://mrush.mobi"
driver.get(url)
login = driver.find_element_by_css_selector("input[name='name']")
login.clear()
login.send_keys("mylogin")
pswd = driver.find_element_by_css_selector("input[name='password']")
pswd.send_keys("mypassword")
driver.find_element_by_css_selector("input[type='submit']").click()

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Ivan Yakushenko, 2019-07-28
@xtsax

checkboxes = driver.find_elements(By.XPATH, '//input[@type="checkbox"]')
for box in checkboxes:
    try:
        box.click()
    except Exception:
        pass

5d3dc70b22626828660069.jpeg

1
1001001, 2019-07-28
@1001001

Why coordinates?

driver.find_element_by_xpath("//*[.='я не робот']").click()

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question