0

Good Morning, I'm using Katalon studio to automate my testing, and I need to launch the chrome driver using selenium, then use it to call Web UI methods in the test cases. the driver launched and opened successfully, but the Web UI methods such as (click, send keys…) in the test cases marked as passed while actually they didn’t, therefore the next step can’t be executed.

it’s noteworthy that the same method sometimes works and sometimes doesn’t.

My Code

def public downloadDocumentSetup() {

 String OldDownloadsPath=RunConfiguration. getProjectDir () + "/Downloads"
 String DownloadsPath= OldDownloadsPath.replace("/", "\\")

         HashMap<Object, String> chromePrefs = new HashMap<Object, String>();
 
 chromePrefs.put("download.default_directory", DownloadsPath)
 chromePrefs.put("profile.default_content_settings.popups",0)
 chromePrefs.put("download.prompt_for_download", false)
 chromePrefs.put("safebrowsing.enabled", "true");
 
 ChromeOptions options = new ChromeOptions()

 options.setExperimentalOption("prefs", chromePrefs)
 DesiredCapabilities cap = DesiredCapabilities.chrome()
 cap.setCapability(ChromeOptions.CAPABILITY, options)
 System.setProperty("webdriver.chrome.driver", DriverFactory.getChromeDriverPath())

 WebDriver driver = new ChromeDriver(cap)
 DriverFactory.changeWebDriver(driver)
 RunConfiguration. setWebDriverPreferencesProperty ("prefs", chromePrefs)



}

My Test Case

WebUI.navigateToUrl(GlobalVariable.WWWSite)
WebUI.click(findTestObject(‘Pages/MyFirstObject’))
WebUI.click(findTestObject(‘Pages/MySecondObject’))

Result The browser opened and navigated to the website successfully, and the first click step marked as passed but actually it didn’t pass, therefore the next click action is not working.

Note My Test case works perfectly when I use ‘Open Browser’ method to launch the driver.

  • how do you know first click does not work , have you checked the console log? – Akzy May 26 '22 at 13:30
  • there's no exception in the console. I'm monitoring running of the test case, it's button that should lead to next page, so I can see that it is not clicked correctly, therefore the next page is not loaded – Hadeelkh May 28 '22 at 10:04
  • Can you add the `HTML` source for this button and `locator` that you are using – Akzy May 29 '22 at 07:18
  • The issue is applicable on most of the elements in the website. I figured out it's timing issue; it seems that Selenium driver is faster than katalon, therefore some actions couldn't be executed correctly, I can proceed with katalon driver with the desired capabilities and it's working perfectly. Thanks for your help @Akzy – Hadeelkh May 31 '22 at 07:48

0 Answers0