'Selenium Unable to select a date from date picker

unable to select a date from date picker

this is the website working on https://www.phptravels.net/

when i used developer options and Ctrl + F on firebug //div[@style='display: block; top: 390px; left: 680px;']//text()[contains(.,'15')]

i am able to find the date on the page

but when i am trying from the code i am unable to select the element

This is my code

self.driver.find_element(By.XPATH, "//div[@style='display: block; top: 390px; left: 680px;']//text()[contains(.,'"+start_date+"')]").click()


test_Flight.py:37: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
..\pages\search_flights_form.py:68: in set_start_date_pick
    self.driver.find_element(By.XPATH, "//div[@style='display: block; top: 390px; left: 680px;']//text()[contains(.,'15')]").click()
..\..\..\..\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\remote\webdriver.py:976: in find_element
    return self.execute(Command.FIND_ELEMENT, {
..\..\..\..\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\remote\webdriver.py:321: in execute
    self.error_handler.check_response(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <selenium.webdriver.remote.errorhandler.ErrorHandler object at 0x052D6D18>
response = {'status': 404, 'value': '{"value":{"error":"no such element","message":"Unable to locate element: //div[@style=\'disp...ntent/shared/webdriver/Errors.jsm:395:5\\nelement.find/</<@chrome://remote/content/marionette/element.js:300:16\\n"}}'}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source