Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I am working on automating some web related task. For that I am using selenium. However, After trying hours I could not figure out to automate date picking. I have two calendars. See the figure to understand better.

[calendars to pick1

What I am trying to achieve is to choose two dates from the left and right calendar. I want to send two dates and set those dates( also month and year) on those two calendars. I tried to do something like that. I took the xpath for "k-calendar k-first-month" class.

calender_left = driver.find_element_by_xpath('//*[@id="filter-section-timeFilters"]/div/div[2]/div/div/div/div[2]/div/div[1]/div/div[1]')
         
ActionChains(driver).move_to_element(calender_left).click().send_keys('02/12/20').perform()

However, no luck on that.

This is how the css elements looks like for the left calendar. enter image description here

Update: I decided to click month and year button using xPath.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
951 views
Welcome To Ask or Share your Answers For Others

1 Answer

Is there any input field to enter date through keyboard?

If YES take xPath or clasName or cssSelector of that element and use sendkeys. Refer the link https://www.browserstack.com/guide/datepicker-in-selenium it will be helpfull.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...