Home > other >  Trying to scrape a site, but having issues on setting xpath to input dates on calendar
Trying to scrape a site, but having issues on setting xpath to input dates on calendar

Time:11-05

I am trying to set some inputs on xpath to scrape a site. However when I set the input to grab the date on a calendar, I am having no luck on setting the dates.

HTML:

<input type="text" id="beginDate-DocumentType" data-mask="00/00/0000" maxlength="10" name="beginDate" title="Begin Date" style="width90px" autocomplete="off" class="hasDatepicker valid"> == $0

PythonScrape

drv.find_element_by_xpath('//input[@name=\"beginDate"]')\
    .send_keys(Start_Date.strftime("%m/%d/%Y"))

From_Date # Original Test Dates From_Date = date(2021, 7, 1) To_Date = date(2021, 7, 7)

Image with HTML and site

CodePudding user response:

In case you seeing selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable error you can try solving it in the following ways:

  1. Add a simple delay, like time.sleep(5) before you trying to access that element.
  2. In case the element is out of the visible screen view you should first scroll that element into the view.
  • Related