Work
Offline
Let us take
below scenario.
I do not have an Internet connection but I saved some WebPages in my computer, is it possible for me to work in selenium?
Answer is YES you can do it like below.
Open the saved webpage in a browser and copy the address in the address bar, this will have protocol as “file᾿ it looks something like below
I do not have an Internet connection but I saved some WebPages in my computer, is it possible for me to work in selenium?
Answer is YES you can do it like below.
Open the saved webpage in a browser and copy the address in the address bar, this will have protocol as “file᾿ it looks something like below
package
pack2;
import
org.openqa.selenium.WebDriver;
import
org.openqa.selenium.firefox.FirefoxDriver;
public class
OpenWebSite
{
public static void
main(String[] args) throws
Exception
{
System.setProperty("webdriver.gecko.driver", "D:\\BrowserDrivers\\geckodriver.exe");
WebDriver driver=new
FirefoxDriver();
// tries to open the html file
driver.get("file:///C:/Users/path/selenium.html");
}
}
No comments:
Post a Comment