4

I am using Selenium Webdriver in Python and I got stuck trying to activate a javascript button.

What I need to do here is to click the Go to Previous Month button twice so that I have August 2014. And then I need to click on one of the days.

The images below show the code. Please tell me if I need to provide more info.

enter image description here

THIS IS THE "GO TO PREVIOUS MONTH BUTTON" + INSPECT ELEMENT

enter image description here

AND HERE I'VE CLICKED ON THE 1ST OF AUGUST + INSPECT ELEMENT ON "1"

How do I do it?

Mikko Ohtamaa
  • 76,495
  • 46
  • 227
  • 378
Alichino
  • 1,598
  • 2
  • 15
  • 24

1 Answers1

3

First find your element with CSS selectors (you need to be familiar how CSS selectors work - this is prerequisite for most web development):

elem = webdriver.find_element_by_css_selector("a[title='Go to previous month']")[0]

Related WebDriver documentantion.

Then when you get your elem (there might paeg loading time, etc. issues you need to deal with) you can click it.

 elem.click()

See also: Wait for page load in Selenium

Related click() documentation.

Community
  • 1
  • 1
Mikko Ohtamaa
  • 76,495
  • 46
  • 227
  • 378