Tricentis Tosca 16.0 Released on Feb-2023 ----- UFT has been upgraded from UFT 15.0.1 to UFT One 15.0.2, Beginning at November 2020.

Saturday 1 May 2021

Demonstrating usage of Selenium through a test application.

Demonstrating usage of Selenium through a test application.

The following prerequisites to run a demo Selenium test script:

  • Java SDK in our respective Operating System.
  • Java-based IDE such as Eclipse or IntelliJ.
  • Selenium Web Driver to be added as a dependency to Java IDE.
package DemoTest;
 
import org.openqa.selenium.firefox.FirefoxDriver;
 
import org.openqa.selenium.WebDriver;
 
 
public class MyFirstTestClass {
 
 
  public static void main(String[] args) throws InterruptedException {
 
//It sets the system property to the given value.
System.setProperty("webdriver.gecko.driver","D:\\Softwares\\geckodriver.exe”);        
 
WebDriver driver = new FirefoxDriver();
 
          driver.get("https://www.google.com/");
 
          //Launch website in the browser 
          driver.manage().window().maximize();
 
  //The sleep pauses the execution of the thread for 5000 ms.
          Thread.sleep(5000);
 
          driver.quit();
 
  }
 
}

Once we run the above script in a Java IDE, we’ll get the following execution logs displayed in your IDE window.

No comments:

Post a Comment

Note: only a member of this blog may post a comment.