How to switch from Java selenium webdriver to Karate driver inside the same Karate script

22 Views Asked by At

I am trying to handle a browser popup which comes at the top of a browser. The API mentioned in Karate doesn't work, hence I used Selenium webdriver inside Karate to handle it and I was able to handle it. However, when I try to switch to Karate driver in the same script to execute rest of the code, it doesn't work.

I called Selenium Java inside Karate script to handle the window switch and then I tried to switch to Karate driver inside the same script, but switching to Karate driver didn't work.

Background:

  • def PopupHandler = Java.type('com.example.PopupHandler')

Scenario: Given driver 'https://www.example.com'

  • driver.click('button#popupButton') // Click on the button that triggers the popup
  • Java.call(PopupHandler.handlePopup, driver)

How to switch to Karate driver after this statement?

0

There are 0 best solutions below