how can I open a Local HTML file on my desktop using the Selenium webdriver?
I tried like below but unable to open
public static String OpenStub (String stub) {
try {
driver=new FirefoxDriver();
driver.manage().timeouts().pageLoadTimeout(10000, TimeUnit.MILLISECONDS);
driver.get("C://Users//sharmayo//Desktop//testlogin.html");
return "Pass";
}
}
We can perform double click on elements in Selenium with the help of Actions class. In order to perform the double click action we will use moveToElement() method, then use doubleClick() method. Finally use build().
While you can't make the Firefox or Chrome web drivers for Selenium tests run any faster, you can create a mock version of your web application that responds lightning fast, allows front-end developers to do functional testing continuously and prevents failed test runs or slow Selenium scripts from delaying releases.
Selenium is a Python module for browser automation. You can use it to grab HTML code, what webpages are made of: HyperText Markup Language (HTML).
You should use file address like this:
driver.get("C:\\Users\\sharmayo\\Desktop\\testlogin.html");
instead of:
driver.get("C://Users//sharmayo//Desktop//testlogin.html");
Try it this way:
driver.get("file:///C:/Users/sharmayo/Desktop/testlogin.html");
UPDATE:
please first try the simplest html file like this (for your testlogin.html)
<html>
<head>
</head>
<body>
<div>Hello World!</div>
</body>
</html>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With