'Non-UI application (console / server application)
#Region Project Attributes
#CommandLineArgs:
#MergeLibraries: True
#AdditionalJar: d:/selenium/client-combined-3.141.59.jar
#AdditionalJar: d:/selenium/libs/guava-25.0-jre.jar
#AdditionalJar: d:/selenium/libs/okio-1.14.0.jar
#AdditionalJar: d:/selenium/libs/okhttp-3.11.0.jar
#AdditionalJar: d:/selenium/libs/commons-exec-1.3.jar
#AdditionalJar: d:/selenium/libs/byte-buddy-1.8.15.jar
#End Region
Sub Process_Globals
End Sub
Sub AppStart (Args() As String)
Log("Location is : " & asJO(Me).RunMethod("doit",Null))
'StartMessageLoop
End Sub
Sub asJO(o As JavaObject) As JavaObject
Return o
End Sub
'Return true to allow the default exceptions handler to handle the uncaught exception.
Sub Application_Error (Error As Exception, StackTrace As String) As Boolean
Return True
End Sub
#if java
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.support.ui.ExpectedCondition;
import org.openqa.selenium.support.ui.WebDriverWait;
import java.lang.Thread;
public static String doit() {
System.setProperty("webdriver.chrome.driver", "d:/selenium/libs/chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.get("file://c:/temp/geo.html");
WebElement ele = driver.findElement(By.name("b1"));
ele.click();
try{
Thread.sleep(4000);
}catch (InterruptedException e){
System.out.println(e.getMessage());
}
Object loc = driver.findElement(By.id("demo")).getText();
//Close the browser
driver.quit();
return (String)loc;
}
#End If