-
Set Remote Driver DesiredCapabilities
-
Added on Listener :
@BeforeTestCase
def beforeTestCase(TestCaseContext testCaseContext) {
String testName = "Test Name: " + testCaseContext.getTestCaseId();
GlobalVariable.testCaseName=testName;println("*********************************"+ GlobalVariable.testCaseName);
}
-
And I saw on log Variable set testCaseName
4 ) Checked Moon
Deep Note :
I know I can use the following code but I don’t want to create a new driver or check if this driver started as remote or local, I want to set DesiredCapabilities for the remote driver directly with this parameter.
import com.kms.katalon.core.context.TestCaseContext
import com.kms.katalon.core.webui.driver.DriverFactory
import org.openqa.selenium.remote.DesiredCapabilities
import org.openqa.selenium.remote.RemoteWebDriver
import java.net.URL
@BeforeTestCase
def beforeTestCase(TestCaseContext testCaseContext) {
String testName = "Test Name: " + testCaseContext.getTestCaseId()
Map<String, Object> moonOptions = new HashMap<>()
moonOptions.put("name", testName)
DesiredCapabilities capabilities = new DesiredCapabilities()
capabilities.setCapability("browserName", "chrome")
capabilities.setCapability("moon:options", moonOptions)
URL remoteUrl = new URL("http://moon.<domain>:4444/wd/hub")
RemoteWebDriver driver = new RemoteWebDriver(remoteUrl, capabilities)
DriverFactory.changeWebDriver(driver)
}