python - Open webpage, then click at coordinates in background -


i trying simulate open webpage send mouse click @ set of coordinates.

i'm wanting event take place in background without opening browser or moving mouse.

for example, open www.google.com , click submit(as set of coordinates) without opening site on screen

is possible?

edit: site may contain javascript

i'd recommend using selenium.
you'll need download chrome or firefox webdriver start off.

here's example skeleton:

from selenium import webdriver  # create new instance of chrome driver driver = webdriver.chrome('c:\chromedriver\chromedriver.exe')  # go google driver.get("http://www.google.com")  # click stuff using xpath driver.find_element_by_xpath('//*[@id="lst-ib"]').click()  # click stuff using coordinates elem = find_element_by_selector(selector) ac = actionchains(browser) ac.move_to_element(elem).move_by_offset(x_off, y_off).click().perform()  driver.quit() 

actionchains api code courtesy of dirk bergstrom


Comments