package mypackage;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.FluentWait;
import com.google.common.base.Function;
public class myclass {
public static void main(String[] args) {
System.out.println("Execution Starts");
WebDriver driver= new FirefoxDriver();
System.out.println("Browser opened.");
// We need to downcast WebDriver reference varaible to use JavascriptExecutor methods
JavascriptExecutor js= (JavascriptExecutor) driver;
String url = "https://www.google.com";
String script = "window.location = \'"+url+"\'";
js.executeScript(script);
System.out.println(driver.getCurrentUrl());
driver.quit();
}
}
Note:
It also keeps current browser session history and you can navigate back and forward
Friday, 30 March 2018
Home
Open URL through Selenium without using get() and navigate() functions
Selenium WebDriver
Open URL through Selenium without using get() and navigate() functions
Open URL through Selenium without using get() and navigate() functions
Tags
# Open URL through Selenium without using get() and navigate() functions
# Selenium WebDriver
About N B
A Passionate enthusiastic ,self motivated software tester who loves and Enjoy testing Web and mobile applications,games.
My Quest in life is to dive into deep ocean of Testing.
I am ISQTB and HIPPA Certified Passionate software tester with hands on and extensive experience in testing Web Applications, Mobile Applications, Games
Tools: Selenium WebDriver, Appium, Jenkins, TestNG, JIRA, Maven, Junit, Accnetix (For Security Testing), SOAP UI (For API Testing), Jmeter (For Load Testing) , BurpSuite(For Security Testing), Test Link, Mantis
Selenium WebDriver
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment