Selenium Webdriver Tips and Tricks – Episode 1


Hi All, from now on, I want to share “Selenium Webdriver Tips and Tricks” series. I hope and believe that it will be a very exciting and interesting series and this post is the first episode of this appealing series. In this episode we will go over below headlines:

1) How to overcome “:” css selector problem for JFS web applications?

Answer: instead of : we should use its hexadecimal equivalent which is \3A

Example:

Invalid: #basicInformationForm:propertyName:propertyName_sub:propertyName_sub_inp

Valid: #basicInformationForm\3ApropertyName\3ApropertyName_sub\3ApropertyName_sub_inp

Reference: http://stackoverflow.com/questions/122238/handling-a-colon-in-an-element-id-in-a-css-selector

2) How to do Human-Like Typing in Selenium?

Answer: You can use below method to do human-like writing

3) How to get a web element by text with Selenium WebDriver?

Answer: CSS does not allow this, you need to use XPath.

//div[contains(text(),’noreply@somedomain.com’)]

Check also CSS/Xpath reference from below link.
https://www.simple-talk.com/dotnet/net-framework/xpath-css-dom-and-selenium-the-rosetta-stone/

4) How to interrogate an element by XPath using JavaScript get element method?

Answer: You can use below code template to get element bt xpath using JavaScript

For example logo of Kariyer.net’s Xpath is “.//*[@id=’Header’]/div[2]/div[1]/a/img”

Referencehttps://coderwall.com/p/u2amea/javascript-get-element-by-xpath 

5) How to upload an image with Robot Class?

Answer: You can use below utility method to upload images with Robot Class.

First episode’s end.

Note: Special thanks to Canberk Akduygu for his contributions.

-Onur

javafx

Database Operations in JavaFX

By Onur Baskirt / Apr 1, 2016 / 56 Comments
Before started this section, please check the first article and learn How to Start JAVAFX! http://www.swtestacademy.com/getting-started-with-javafx/ At first, part of JavaFX tutorial series, we created a sample JavaFX project, designed the draft version of the UI and set up an...
rest assured

REST API Testing with Rest Assured

By Onur Baskirt / Mar 8, 2016 / 32 Comments
Outline In this post, I will explain what is API and API testing, what is the difference between SOAP and REST services, and how to test REST APIs with Rest Assured Library. What is API? API stands for Application Programming...
extentreports

How to Write Effective CSS Locators

By Onur Baskirt / Oct 1, 2017 / 0 Comments
Hi all, in this tutorial, I will describe you how to write effective CSS locators to interrogate web elements for your automation projects. As a rule of thumb, your interrogation strategy should be in below order: First try to use...
extentreports

Selenium-11: Execute JavaScript with JavascriptExecutor

By Onur Baskirt / Jan 27, 2016 / 15 Comments
Outline Sometimes we cannot handle some conditions or problems with Webdriver, web controls don't react well against selenium commands. In this kind of situations, we use Javascript. It is useful for custom synchronizations, hide or show the web elements, change...
javafx

Getting Started with JavaFX

By Onur Baskirt / Mar 25, 2016 / 0 Comments
When I started to work in my current position, one of my task is to do manual operations for campaign products  every week. After the second week, I thought that I have to automate this task using a GUI based...
extentreports

How to Write Smart XPath Locators

By Onur Baskirt / Sep 24, 2017 / 4 Comments
Hi all, in this tutorial, I will describe you how to write smart and non-brittle XPath locators. When we write our test scripts, we generally prefer to use id, name, class, etc. these kinds of locators. However, sometimes we could not...
extentreports

Selenium-1: Quick Start to Automation with Selenium WebDriver & JAVA & JUnit & Maven & IntelliJ

By Onur Baskirt / Sep 8, 2015 / 26 Comments
Outline Selenium Webdriver is the most popular open source web test automation framework across wide range of browsers and platforms. In this tutorial you will learn how to do web test automation with Selenium Webdriver and the related tools. Audience...
page object model

Page Object Model with C#

By Ege Aksoz / Jun 18, 2017 / 8 Comments
In the previous tutorial, we’ve taken the initial steps and entered the world of automated testing. We also wrote our first automated test. From this point on, since we are not just going to write one test, we need to...
extentreports

How to Select a Date From DatePicker Using Selenium

By Onur Baskirt / Aug 13, 2016 / 6 Comments
When you need to automate a airway, hotel, or similar websites you need to deal with Datepickers and some times it is a little bit cumbersome to select a specific date on the Datepicker or calendar.  In this post, I...
extentreports

Selenium Webdriver Performance testing with Jmeter and Selenium Grid

By Ozgur Kaya / Aug 9, 2016 / 2 Comments
In this post, we will complete Selenium Webdriver Performance testing scenario using Jmeter and Selenium Grid. 1- Install Java 7 or later If necessary https://java.com/tr/download/ 2- Download latest Jmeter version 3.0 or higher. http://jmeter.apache.org/download_jmeter.cgi 3- Download Jmeter PluginsManager JAR file and...
By | 2017-03-05T22:19:00+00:00 March 4th, 2017|Selenium, Test Automation|4 Comments

About the Author:

Onur Baskirt
Onur Baskirt is a senior IT professional with 10+ years of experience. He worked at Bahçesehir University, ST Microelectronics, Huawei and Ericsson as research assistant, design verification engineer and software test leader. Also, he worked as software test leader and software operations manager at Turkey's biggest technology retailer, Teknosa. Now, he is working as Head of Software Testing and Manager of two Development Teams at Kariyer.net. His current research areas are technical software testing, programming, and computer science. Formerly, he has several research works and papers on digital chip design & verification. His hobbies are sport, dancing, traveling, and nutrition. You can find detailed information about him on his linked-in page.

4 Comments

  1. Ali Ulvi Talipoğlu March 5, 2017 at 8:14 pm - Reply

    3rd Q. supports also CSS. 3) How to get a web element by text with Selenium WebDriver?
    Element containing text ‘t’ in CSS is E:contains(‘t’)

    • Onur Baskirt March 5, 2017 at 9:45 pm - Reply

      CSS: The CSS2 contains function is not in CSS3; however, Selenium supports the superset of CSS1, 2, and 3.

  2. Ray July 11, 2017 at 6:41 pm - Reply

    Very informative. Waiting for the next episode. Many Thanks

Leave A Comment