Not able to call onclick datepicker function python selenium

0 votes

I'm trying to pass the values into the form. It is passing the values in the normal text box, I couldn't succeed in the onclick datepicker function

Below is the code:

import urllib

from selenium import webdriver

from selenium.webdriver.support.ui import Select

from selenium.webdriver.common.keys import Keys

driver = webdriver.PhantomJS(executable_path="C://Users//phantomjs//bin//phantomjs.exe")

driver.get('https://enquiry.icegate.gov.in/enquiryatices/sbTrack')

select = Select(driver.find_element_by_name('sbTrack_location'))

select.select_by_value("MUNDRA SEA (INMUN1)")

sb_no = driver.find_element_by_name("SB_NO")

sb_no.send_keys(7353156)

sb_dt = driver.find_element_by_name("SB_DT")

sb_dt.send_keys("2017/07/14")

driver.save_screenshot("test1_scr.png")

I am unable to send keys to tag with readonly input property from here.

<input type="text" name="SB_DT" value="" readonly="readonly" id="sbDATE">
Jun 8, 2018 in Selenium by Martin
• 4,320 points
3,557 views

1 answer to this question.

+1 vote

To pass customized dates e.g. 2017/07/14. You have to remove the attribute readonly="readonly" and then send the date as text as follows:

sb_dt = driver.find_element_by_xpath("//input[@id='sbDATE']")

driver.execute_script("arguments[0].removeAttribute('readonly')", sb_dt);

sb_dt.send_keys("2017/07/14")

answered Jun 8, 2018 by Samarpit
• 5,910 points

Related Questions In Selenium

0 votes
1 answer

Not able to upload a file in Selenium Webdriver using python Scripting

Hey Srinivas, you can checkout this code ...READ MORE

answered Sep 10, 2019 in Selenium by Abha
• 28,140 points
3,931 views
0 votes
1 answer

Not able to identify datepicker in chrome for my site "tui.co.uk".

Dear Vamshi, After clicking on the date box ...READ MORE

answered Jun 21, 2018 in Selenium by walter 123
• 240 points
503 views
0 votes
1 answer

Not able to open a new URL in a new tab in Selenium

There is a bug in ChromeDriver that ...READ MORE

answered May 21, 2018 in Selenium by Meci Matt
• 9,460 points
18,223 views
0 votes
2 answers

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,500 points
12,721 views
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

enable trusted connection  in internet explorer by ...READ MORE

answered Aug 31, 2020 in Selenium by Sri
• 3,190 points
8,613 views
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,910 points
6,686 views
0 votes
2 answers

How to use such xpath to find web elements

xpath are two types. 1) Absolute XPath:    /html/b ...READ MORE

answered Sep 3, 2020 in Selenium by Sri
• 3,190 points
7,554 views
0 votes
1 answer

Not able to login using selenium webdriver using Java Language

Try to send text to the username ...READ MORE

answered Jul 17, 2018 in Selenium by Samarpit
• 5,910 points
2,168 views
0 votes
1 answer

How to login a forum using Selenium with Python

You should try to directly log in ...READ MORE

answered Apr 27, 2018 in Selenium by Samarpit
• 5,910 points
2,387 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP