
- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What are the most basic steps to write a web driver script?
The most basic steps to write a web driver script are listed below −
Open any browser by creating a webdriver reference pointing to the corresponding browser driver class.
Launch any URL with the get() method.
Pause for some time for the page load.
Confirm that we are on the correct web page.
Finally close the session.
Code Implementation
Example
import org.openqa.selenium.By; import org.openqa.selenium.Keys; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import java.util.concurrent.TimeUnit; public class WebScripting { public static void main(String[] args) { System.setProperty("webdriver.chrome.driver", "C:\\Users\\ghs6kor\\Desktop\\Java\\chromedriver.exe"); WebDriver driver = new ChromeDriver(); String url = "https://www.tutorialspoint.com/index.htm"; // launching the URL driver.get(url); driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); System.out.println("Page loaded successfully"); driver.close(); } }
- Related Questions & Answers
- How to run Selenium web driver from a Python CGI script?
- What is selenium web driver?
- What is the Selenium Web Driver Architecture?
- What is Web Driver in Selenium?
- What are the key steps in read/write from/to a URL connection in java?
- What are the steps to rename a file in Git?
- What are the basic computational models?
- How to run selenium (Firefox) web driver without a GUI?
- What are the pre-conditions for Selenium Internet Explorer Driver or IE Driver?
- Difference between selenium RC and Web Driver?
- What are the different steps involved to execute a Java program?
- Using Selenium Web Driver to retrieve value of a HTML input.
- How to get userAgent information in Selenium Web driver?
- What are Web Pages?
- What are the steps to read static members in a Java class?
Advertisements