top of page

Selenium Java Concept 01

  • Prasanta Paul
  • Apr 14, 2022
  • 1 min read
  1. How to Call Web Driver

System.SetProperty("WebDriver.Chrome.driver", "Path of the chrome driver");

WebDriver Driver = New Chrome Driver();

or we can write Chrome Driver= New Chrome Driver();

Or we can write RemoteWebDriver Driver= New ChromeDriver();

Note: WebDriver is a Interface

ChromeDriver is a Class

Driver is a Object reference name

New is a Object of the chrome class.


2. What are the way to launch website

- driver. get("Url");

- driver. navigate().To("URL");


3. Types of locator in Selenium

There are 8 (Eight) types of locater in Selenium.

i) Id, ii) Name, iii) Class name, iv) CSS, v) Xpath, vi) Parallel link test, vii) link text, viii) Tag name


4. Show few Example of customized x-path

i) //a[contains(text(),'value of the element')] -- With contain Text

ii) // input[@type ='submit' and @ name='xyz'] -- With and

iii) // input [@type ='submit' or @ name='xyz'] -- With or

iv) // input[@id='xyz']//parent::div -- Move to the parent element

v) // input [@='example']// following-sibling:: input -- Move to the

//*[@type='text']//following::input

vi) // input[@'example']// preceding-sibling::input -- used to fetch a web element which is a sibling to the parent

//*[@type='text']//preceding::input

vii) //div[.//name='SELE']]/ancestor::div[@class="abc']/following-sibling::div --

viii) //*[@id='abc']//descendant::a




Comments


bottom of page