Having trouble using Javascript Executor with Katalon

Can someone point me in the right direction on how to use Javascript executor on a sample site for modifying a data of a control on a ReactJS page - https://www.airbnb.com/. I just want set the value of this control.

So far I have performed the attached, and I cannot get it to work

Try…

WebUI.executeJavaScript("document.querySelector('#checkin_input').value = 'Thu, Jun 27';", null)
1 Like

With the WebUI API, don’t you have to provide a second argument?:

WebUI.executeJavaScript("document.querySelector('#checkin_input').value = 'Thu, Jun 27';", null)

1 Like

Also, just an FYI, with ReactJS pages, while you can set values using JS, the page often won’t recognize that the data has been entered (it will appear that the field gets set in your browser, but when the form is actually submitted, React will act like the field is still empty…). In my experience, you have to simulate physical keystrokes using webdriver (which is a huge pain). This is hit or miss though, so JS might work fine in this case.

Yeah. My bad.

Usual “shadow” problems.

Issue a call to the element.change() method (triggering an onchange event).

1 Like

(@amad410 I removed your duplicate post).

If you look at the site, there is no event to call for change(). There is no event associated with text box that is populated from the data control.

Have you established there is no delegate handler further up the hierarchy?

Alternatively, take a leaf out of @Brandon_Hein’s book… try with sendKeys.