Library Usage with Java

1- Upload the following code as DummyLib.Java file to the project.

//NO NEED TO ADD package Libraries; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; import manager.DriverManager; import manager.MomentumDriver; import java.io.IOException; public class DummyLib{ private MomentumDriver driver = DriverManager.currentDriver; public void doSomething() throws IOException { WebElement element_4 = (WebElement) driver.findElement(By.xpath("//*[contains(@content-desc, \"abc\")]/android.widget.TextView")); element_4.click(); driver.log("my custom log"); driver.saveScreenshot(); } }

2- Open the Case Import TAB and paste this code line.

import Libraries.*;

3- Open step Code and call the function.

DummyLib dummyLib = new DummyLib(); dummyLib.doSomething();

 

Related Links: