0

I'm using chrome extension to automate my few tasks, one of them is to select the date from datepicker. but i'm unable to perform actions on Jquery UI datepicker by using its methods such as: $(".hasDatepicker").datepicker("setDate", new Date("01/03/2022")); or getting date: $(".hasDatepicker").datepicker("getDate"); i display the result in console and it returns undefine. Inside manifest file, i also included the jquery-ui.js file, here it is:

{
    "manifest_version": 3,
    "name": "Auto Cart",
    "version": "1.0",
    "content_scripts": [
        {
            "matches": [
                "https://www.billetterie-parismusees.paris.fr/*"
            ],
            "js": [
                "jquery.js",
                "jquery-ui.js",
                "content.js"
            ]  
        }
    ],
    "action": {
        "default_popup": "popup.html"
    },
    "permissions": ["storage","activeTab"]
}

Important: I can get and set values of datepicker from console but it doesn't work from content-script.js file. Can anyone pls help me in resolving this issue?

  • Show where hasDatepicker element is created and how it is initialized. – wOxxOm Apr 10 '22 at 08:49
  • Actually, i was trying to automate a website on which we can purchase tickets based on available date and time. We have to choose a date and its available time will be shown below. But i am unable to get/set datepicker from content-script.js. here is the link of the site which i want to automate: https://www.billetterie-parismusees.paris.fr/selection/timeslotpass?productId=101780864448&gtmStepTracking=true – Rida Fatima Apr 10 '22 at 08:56
  • In that case remove jquery from content_scripts, and just use the site's jquery by running $ code in [page context](/a/9517879). – wOxxOm Apr 10 '22 at 09:19
  • This would suggest that jQuery UI is not loading. If the element exists in the page, yet `.datepicker()` is undefined, then either you need to wait for it to load or determine why it is not loading. – Twisty Apr 11 '22 at 02:17

0 Answers0