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,220 points
1,004 views

1 answer to this question.

0 votes

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,130 points

Related Questions In Selenium

0 votes
1 answer
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 20, 2018 in Selenium by walter 123
• 240 points
62 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,420 points
7,748 views
0 votes
1 answer

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,090 points
568 views
0 votes
1 answer
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,130 points
896 views
0 votes
1 answer

How to use such xpath to find web elements

It's much simpler to use: #MyDiv123 > div.super or ...READ MORE

answered Jun 14, 2018 in Selenium by Samarpit
• 5,130 points
561 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,130 points
292 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,130 points
298 views