In Karate end to end testing not able to select element like 34(awesome) from search dropdown filtered options

49 Views Asked by At

I am facing a challenge in selecting a drop-down value in Karate tests. Some of my values contain brackets in it. For example, 34 (Awesome). If I try to search and select this particular value, it does not work.

Search with 34 - search returns no results Search with 34 (Awesome) - search returns no results Search with Awesome - 34 (Awesome) is available for selection, but somehow Karate is not able to select the value.

Ui_device.feature file has related below test case content: -

ScenarioOutline:ShouldaddDevicetimeotherinputandsubmit&validateuserselectedvalue
*configureafterScenario=function(){karate.call('subFeature/callOnce.feature@tearDown',{caller:karate.feature.fileName});}
*deftest=karate.call('classpath:sampleFeature/subFeature/callOnce.feature@webDeclare');
*test.devicePage.get(deviceLink);
#*test.devicePage.signIn("<email>","<password>");
*test.devicePage.ClickButton();
*test.devicePage.searchAndSelectDeviceName("<device>");
*test.devicePage.searchAndSelectDeviceLine("<deviceLine>");
*test.devicePage.searchAndSelectDeviceCode("<deviceCode>");
*test.devicePage.clickDeviceSetupContinue();
*test.devicePage.checkInputParamSectionVisible();
*test.devicePage.addOtherValue("<days>")
*test.devicePage.quitBrowser();
 
Examples:
|email|password|device|deviceLine|deviceCode|days
|[email protected]|somePassword|QP-123|KAPAFREEZE|Promotional|10

DevicePage.java file has related below content: -

publicvoidsearchAndSelectDeviceCode(StringgroupCodeStr)throwsInterruptedException{
WebElementdeviceCodeSelectionInput=webDriver.findElement(By.id("select-input-devicecode"));
//ClickDevicecodeselectioncontainertoopenmenuandtypekeyword&selectoption
click(deviceCodeSelectionInput);
delay(3000L);
WebElementdeviceCodeSearchBox=webDriver.findElement(By.id("search-options-input-devicecode"));
writeText(deviceCodeStr,deviceCodeSearchBox);
delay(3000L);
WebElementselectDeviceCodeFromMenu=webDriver.findElement(By.id("menu-option-0-devicecode"));
click(selectDeviceCodeFromMenu);
delay(3000L);
}

I tried to select the result with 34(awesome) after getting searched in the dropdown filtered results but I am failed to do so. I am expecting the search filtered result term i.e.34(awesome) to be get selected while karate end to end test execution.

0

There are 0 best solutions below