Change InnerHTML for div and span elements

Hi,

I have a dynamic dropdown which does not have options but it is designed as div elements and the innerHTML of the div changes as the user chooses an option. I am not able to change this text for automation

Initial HTML before clicking on dropdown

Clicked on dropdown

Finally when value is selected

Any help in automating this would be helpful

In your second screenshot, after you’ve clicked the dropdown, the ‘Yes’ and ‘No’ options have to exist somewhere in the DOM, even if they don’t exist prior to opening it. If you can find the options somewhere, your approach could be something like:

1.) Click dropdown
2.) Get options from opened dropdown
3.) Click desired option

Another option is to try and send keys to the field, assuming you know the options ahead of time, then send an ENTER:

import com.kms.katalon.core.webui.common.WebUiCommonHelper
import org.openqa.selenium.Keys
import org.openqa.selenium.WebElement

WebElement dropdown = WebUiCommonHelper.findWebElement(findTestObject('path/to/test/object'))
dropdown.sendKeys("Yes")
dropdown.sendKeys(Keys.ENTER)
1 Like

Thanks Brandon,

Second method helped but I am looking to get it work with first option

1 Like