Hi, I have written a Keyword which launches Android Driver object and executed tests on cloud mobile test platform through Katalon. But I would like use WebUI keywords during the test so I think passing Android Driver object to WebUI driver would help me to achieve this. Could you please help me how to do this or suggest me which is the best way to use WebUI key words along with plain java code in my situation.
Code is below
@Keyword
public static void main() throws MalformedURLException, InterruptedException {
DesiredCapabilities caps = new DesiredCapabilities();
caps.setCapability(“app”, “bs://68759ccb92721e210aa81ddbe8f18b74e419990e”);
caps.setCapability(“device”, “Samsung Galaxy S8 Plus”);
caps.setCapability(“browserstack.local”, “true”);
AndroidDriver driver = new AndroidDriver(new URL(“https://“+_userName_+”:“+_accessKey_+”@hub-cloud.browserstack.com/wd/hub”), caps);
new WebDriverWait(driver, 30).until(ExpectedConditions.presenceOfElementLocated(By.xpath(“//*[@text=‘No account yet? Create one’]”)));
driver.findElement(By.xpath(“//*[@text=‘No account yet? Create one’]”)).click();
new WebDriverWait(driver, 30).until(ExpectedConditions.presenceOfElementLocated(By.xpath(“//*[@id=‘input_name’]”)));
driver.findElement(By.xpath(“//*[@id=‘input_name’]”)).sendKeys(“wrwerwer”);
new WebDriverWait(driver, 30).until(ExpectedConditions.presenceOfElementLocated(By.xpath(“//*[@id=‘input_address’]”)));
driver.findElement(By.xpath(“//*[@id=‘input_address’]”)).sendKeys(“sdasdfasdf”);
new WebDriverWait(driver, 30).until(ExpectedConditions.presenceOfElementLocated(By.xpath(“//*[@id=‘input_email’]”)));
driver.findElement(By.xpath(“//*[@id=‘input_email’]”)).click();
driver.findElement(By.xpath(“//*[@id=‘input_email’]”)).sendKeys(“asdfsdf”);
new WebDriverWait(driver, 30).until(ExpectedConditions.presenceOfElementLocated(By.xpath(“//*[@text=‘Already a member? Login’]”)));
driver.findElement(By.xpath(“//*[@text=‘Already a member? Login’]”)).click();
driver.quit();
}