0

I'm trying to make a script and run it using Tampermonkey. Website belongs to a Visa Application Center in Morocco (https://morocco.blsspainvisa.com/book_appointment.php).

Once I open the webpage, I get a popup. Code is made to close it. Then when I choose the city: Tangier, I get another popup. Then I select the category: Normal, phone number and email address.

document.querySelector("#IDBodyPanelapp > div.popup-appCloseIcon").click();
document.getElementById('centre').value="8#3";
document.querySelector("#IDBodyPanelapp > div.popupDivCenter").click();
document.getElementById('category').value="Normal";
document.getElementById('phone').value="60000000";
document.getElementById('email').value="email@gmail.com";

I need to automate this process with prefilled values. I've done that but the only problem is that when I use the above code, the Category dropdown menu remains empty. It seems that the values don't get loaded in order to select one.

a2i2
  • 1
  • 1
  • Usually you also need to dispatch a 'change' event ([example](https://stackoverflow.com/a/47733714)). – wOxxOm Aug 08 '19 at 14:28
  • Is there a way to make it load and select a predefined value automatically ("normal" in this case), without manually clicking or selecting ? – a2i2 Aug 08 '19 at 14:33
  • Probably a duplicate of https://stackoverflow.com/questions/15048223/choosing-and-activating-the-right-controls-on-an-ajax-driven-site. May hammer later. – Brock Adams Aug 08 '19 at 14:41

0 Answers0