Selenium WebDriver

Tests on Browsers

Remember to check version of WebDriver with current browser version.

  1. Create a new Python Package in your project

  2. Create a new Python File (and then code and run there)

Mozilla Firefox

Firefox WebDriver is called geckodriver.exe

page information's
geckodriver

After this program the Firefox doesn't close.

Xpath

website to practice
Add-ons Try
Xpath in firefox console

Google Chrome

Google Chrome driver is call chromedriver.exe

When using class in ChromeDriver, after the page is load the browser will close. Without class the browser stay on this site.

Xpath

Find elements by use cltr+F
In Console

Extension Ranorex Selocity

  1. Inspect element

  2. Ranorex Selocity show <input> css / xpath to copy to automation tests

Ranorex Selocity how to use

Internet Explorer

Internet Explorer driver is called IEDriverServer.exe

Requirements to run tests on Internet Explorer

  1. Set a zoom on 100%

2. Make sure that Protected Mode on every of 4 types of zone are the same (Disable or Enable) a) Internet b) Local intranet c) Trusted sites d) Restricted sites

Safari

It's only supported on Macs. (Apple)

Commands

import webdriver

set a webdriver

open a URL

Finding elements

By

CSS Selectors

Syntax: tag[attribute='value']

"#" -> Id "." -> Class

Appending Classes

.class1.class2.class3 -> Until we find a unique element

Wildcards in CSS Selectors

Syntax: tag[attribute<special character>='value']

Finding Children CSS

Xpath

Single slash ‘/’ anywhere in xpath signifies to look for the element immediately inside the parent element. Double slash ‘//’ signifies to look for any child or nested-­‐ child element inside the parent element.

Syntax: //tag[@attribute='value']

contains

Syntax: //tag[contains(attribute, ‘value’)]

starts-with

Syntax: //tag[starts-­‐with(attribute, ‘value’)]

1 matching node

parent and sibling

Parent Syntax: xpath-­‐to-­‐some-­‐element//parent::

Preceding Sibling Syntax: xpath-­‐to-­‐some-­‐element//preceding­‐sibling::

Following Sibling Syntax: xpath-­‐to-­‐some-­‐element//following-­sibling::

Practice

1. Find the price of the course "Python Programming Language"

http://letskodeit.teachable.com/p/practice

2. Find the Project name from Owner Maria Kennedy

https://dhtmlx.com/docs/products/dhtmlxGrid/

Last updated

Was this helpful?