Select an option in website’s mobile version (responsive mode)

Tags: , , , ,



How can I select a size option from https://www.supremenewyork.com/mobile#products/305278, when I’m browsing it in responsive mode? I tried it with document.querySelector("#size-options > option:nth-child(2)").selected = "selected"; but it doesn’t work.

In desktop mode https://www.supremenewyork.com/shop/pants/n1to4psjk/wlmx7p5hr the method document.querySelector("#size > option:nth-child(3)").selected = "selected"; works as expected.

Answer

You can use
document.querySelector("#order_billing_country").value = "countryCode";
and it will work on both desktop and mobile.
The UI on mobile never gets updated, but when you press process payment, the right value is sent to Supreme.



Source: stackoverflow