UrbanPro
true

Find the best tutors and institutes for QA

Find Best QA Training

Please select a Category.

Please select a Locality.

No matching category found.

No matching Locality found.

Search for topics

Learn QA with Free Lessons & Tips

Ask a Question

Post a Lesson

All

All

Lessons

Discussion

Lesson Posted on 18 Nov IT Courses/QA/Selenium IT Courses/QA/Selenium/Selenium with Java

CheatSheet for xpath/css used in Selenium (UI Automation Testing)

Sarthak Chadha

I am Sr. QA Lead having experience in multiple companies/projects. Currently working in Top MNC in Noida. Experience...

Locators Dynamic XPath String a = "//html/body/div/header/nav/div/div/ul/li/div/div/span/div/div/div"; String xp = a + i + b; =========================================== Xpath By.xpath("//span" //div/button //div //input ... read more

Locators

 

Dynamic XPath

String a = "//html/body/div[2]/header/nav/div[2]/div/ul[2]/li[7]/div/div[2]/span/div/div/div[";

                     int i = 1;

                     String b = "]";

 

                     String xp = a + i + b;

 

 

 

===========================================

 

 

 

 

Xpath

 

By.xpath("//span[@class = 'close-icon close']"

 

 

//div[@id="pancakes"]/button[0]

 

//div[@id='' and @value='']

 

 

 

//input[@id='identifierId']

 

Contains:

//img[contains(@src,'Profile')]

 

Starts-with

//img[starts-with(@alt,'Visit on...')]

 

text:

//*[text()='abc']

 

//a[contains(text(),'abc')]

 

Mulitple Attributes:

//HTMLTAG[@att1=''][@att2='']

 

//HTMLTAG[@att1='' and @att2='']

 

//HTMLTAG[@att1='' or @att2='']

 

 

last:

(//input[@class=''])[last()]

(//input[@class="whsOnd zHQkBf"])[last()]

(//input[@class="whsOnd zHQkBf"])[last()-1]

 

 

Position:

(//input[@class="whsOnd zHQkBf"])[position()=1]

(//input[@class="whsOnd zHQkBf"])[position()=2]

 

here index start from 1

 

 

following:

 

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

//*[@id='FirstName']/following::input

 

preceding:

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

//*[@id='LastName']/preceding::input

 

 

ancestor:

.//*[@class=’container-fluid’]//ancestor::div[1] – Returns 13 nodes

.//*[@class=’container-fluid’]//ancestor::div[2] – Returns 7 nodes

.//*[@class=’container-fluid’]//ancestor::div[3] – Returns 5 nodes

.//*[@class=’container-fluid’]//ancestor::div[4] – Returns 3 nodes

.//*[@class=’container-fluid’]//ancestor::div[5] – Returns 1 node

 

child:

//nav[@class=’fusion-main-menu’]//ul[@id=’menu-main’]/child::li

 

decendant:

//nav[@class=’fusion-main-menu’]//*[@id=’menu-main’]//descendant::li

 

 

 

 

 

Naurki.com > More

ul.midSec.menu>li:nth-child(5) a div

 

css

 

input[name=email][type=text]

 

  1. If we have id

 

HTMLTag#idname

input#Email

 

  1. If we have class

HTMLTag.classname

input.abc

 

  1. Prefix

css=input#Passwd[name^=’Pass’]

 

  1. Sufix

css=input#Passwd[name$=’wd’]

 

  1. Substring

css=input#Passwd[name*=’wd’]

 

  1. contain text

css=input:contains('abc')

 

css=input[name*='sw']

 

 

  1. child selector

 

label>input

 

 

  1. child element

with space

 

  1. <ul id="fruit">

    <li>Apple</li>

    <li>Orange</li>

    <li>Banana</li>

</ul>

 

css="ul#fruit li:nth-of-type(2)

 

 

10.

 

Not contain

css = "div[class*=calendar-day-]:not([class*='unavailable'])"

 

 

 

 

===========================================

 

id

 

driver.findElement(By.id("txtPassword")).sendKeys("abc@123");

 

driver.findElement(By.id("Email")).sendKeys("atyagi.mails");

 

 

===========================================

 

 

name

 

driver.findElement(By.name("signIn")).click();

 

 

 

 

 ================================

dom

 

following ways: document.forms[0].elements[0]

 

document.forms[‘loginForm’].elements[‘username’]

 

document.forms[‘loginForm’].username

 

document.getElementById(‘username’)

 

 =================================

  1. //HTML-TAG[@att = 'val']

 

//div[@class = 'mTxt'] = Job

 

//div[@class = 'mTxt'] = Rec

 

-----------------------

 

2.

 

//descendant::HTML-TAG[@att = 'val'][num]

 

//descendant::div[@class = 'mTxt'][1]

 

------------------------------

3.

 

//HTML-TAG[text() = 'txtVal']

 

//div[text() = 'Jobs']

 

//input[@class = 'sdTxt w85']

 

read less
Comments
Dislike Bookmark

Lesson Posted on 18 Nov IT Courses/QA/Selenium IT Courses/QA/Selenium/Selenium with Java IT Courses/Java +1 IT Courses/Java/Core Java less

Constructor Overloading

Sarthak Chadha

I am Sr. QA Lead having experience in multiple companies/projects. Currently working in Top MNC in Noida. Experience...

public class ConstructorOverloading { public ConstructorOverloading(){ System.out.println("default"); } public ConstructorOverloading(String a){ System.out.println("a"); } public ConstructorOverloading(int a){ System.out.println("1"); } public ConstructorOverloading(String a, int ab){ System.out.println("a,... read more

public class ConstructorOverloading {


public ConstructorOverloading(){
System.out.println("default");
}


public ConstructorOverloading(String a){
System.out.println("a");
}

public ConstructorOverloading(int a){
System.out.println("1");
}


public ConstructorOverloading(String a, int ab){
System.out.println("a, 1");
}


public ConstructorOverloading(String ac, int a, int ab){
System.out.println("a 1, 1");
}

public static void main(String args[]) {

ConstructorOverloading obj = new ConstructorOverloading("test", 2);

}
}

read less
Comments
Dislike Bookmark

Looking for QA Training

Find best QA Training in your locality on UrbanPro.

FIND NOW

Answered on 04 May IT Courses/QA/Automation Testing

Saroj Kumar

IT Professional trainer with 10 years of experience in Java & Automation tools like selenium.

Since you already have good automation, try to upgrade yourself in the same domain with additional tools & technology like API/web services testing, mobile automation-appium, selenium using C# & python. Nowadays, API automation is in high demand. Along with this, try different hands-on frameworks... read more

Since you already have good automation, try to upgrade yourself in the same domain with additional tools & technology like API/web services testing, mobile automation-appium, selenium using C# & python. Nowadays, API automation is in high demand.

Along with this, try different hands-on frameworks and CI/CD.

read less
Answers 7 Comments
Dislike Bookmark

Lesson Posted on 20/07/2020 IT Courses/QA/Selenium/Selenium with Java

Selenium Training First Class

Kamaljeet Singh

I am an Automation/Performance Architect and has used multiple tools for End to End Automation and Performance...

Comments
Dislike Bookmark

Answered on 02/04/2020 IT Courses/QA/Selenium

Rahul Dev

Certified Full Stack Automation Engineer with 7+ Years experience in IT Industry

If you're new to coding, I do prefer Python as more like to a descriptive language. But you'll notice less selenium support in web while compared to Java. Java has a broad support base. But Selenium with Python will have good demand over Java. I suggest having unique skills, like Python.
Answers 47 Comments
Dislike Bookmark

Lesson Posted on 19/12/2019 IT Courses/QA/Selenium/Selenium with Java

How to Read Data From Property File

Sarthak Chadha

I am Sr. QA Lead having experience in multiple companies/projects. Currently working in Top MNC in Noida. Experience...

1. Create a property file using New > File > Given name - like config.properties (it must be saved with .properties). 2. Add data in config.properties like: browser = chrome environment = qa 3. Add a class to read the property file (see below class) import java.io.FileInputStream;import java.io.IOException;import... read more

1. Create a property file using New > File > Given name - like config.properties (it must be saved with .properties).

2. Add data in config.properties like:

browser = chrome

environment = qa

3. Add a class to read the property file (see below class)

import java.io.FileInputStream;
import java.io.IOException;
import java.util.Properties;

public class ReadingProperties {

static FileInputStream fis;
static Properties prop;

public static String getValueOfPropertyFile(String value) throws IOException {

fis = new FileInputStream("-------Path of the property file-------");
prop = new Properties();
prop.load(fis);

return prop.getProperty(value);
}

}

4. Where you want to read the data just call - ReadingProperties.getValueOfPropertyFile("----pass the key which you want from property file").

The function will return to the value of that key.

read less
Comments
Dislike Bookmark

Answered on 25/11/2019 IT Courses/QA/Automation Testing/Test Complete

hi, I am looking for cypress automation testing with type script online training. Please let me know... read more

hi,

I am looking for cypress automation testing with type script online training. Please let me know anyone have good experience and ready to provide training ASAP.

 

Thanks,

chaithanya

read less

Bobby S

SAP ABAP Consultant with 5+ years of experience and 2 years experience in training

Check in Google and search at ameerpet, you will get information
Answers 1 Comments
Dislike Bookmark

Answered on 25/04/2018 IT Courses/QA/Selenium

Mindmajix Technologies INC

Selenium is good to learn. It has good future. Learn selenium automation & expertise in using Selenium 3.0 to create robust, browser-based regression automation suites and tests, scale and distribute scripts and create quick bug reproduction scripts. You will master selenium IDE, Selenium webDriver,... read more

Selenium is good to learn. It has good future. Learn selenium automation & expertise in using Selenium 3.0 to create robust, browser-based regression automation suites and tests, scale and distribute scripts and create quick bug reproduction scripts. You will master selenium IDE, Selenium webDriver, JaCoCo, TestNG, Sikuli, Page Object Modeling and Optimize XPath with Xpather and Selenium RC. You will also get an exposure to industry based real-time projects in various verticals.

 

Mindmajix provides best Selenium online training. Training by real time experts. Schedule and attend free online demo here! https://mindmajix.com/selenium-training

read less
Answers 5 Comments 1
Dislike Bookmark

Looking for QA Training

Find best QA Training in your locality on UrbanPro.

FIND NOW

Answered on 03/12/2017 IT Courses/QA/Selenium

Why is choosing xpath as a locator not considered a good practice in selenium?

Logeswaran

Python Automation/Development Trainer for working professionals

we can locate element by id,class,xpath, etc., 1) 'id' is unique for all component in html, so searching by id is good option, will reduce the searching time where as xpath will take long-time to find the html element. This is why using xpath is not good practice, but if id is not available then no... read more
we can locate element by id,class,xpath, etc., 1) 'id' is unique for all component in html, so searching by id is good option, will reduce the searching time where as xpath will take long-time to find the html element. This is why using xpath is not good practice, but if id is not available then no other way than pick by xpath. read less
Answers 2 Comments
Dislike Bookmark

About UrbanPro

UrbanPro.com helps you to connect with the best QA Training in India. Post Your Requirement today and get connected.

Overview

Questions 470

Lessons 77

Total Shares  

+ Follow 7,150 Followers

Related Topics

Top Contributors

Connect with Expert Tutors & Institutes for QA

x

Ask a Question

Please enter your Question

Please select a Tag

X

Looking for QA Classes?

Find best tutors for QA Classes by posting a requirement.

  • Post a learning requirement
  • Get customized responses
  • Compare and select the best

Looking for QA Classes?

Find best QA Classes in your locality on UrbanPro

Post your learning requirement

UrbanPro.com is India's largest network of most trusted tutors and institutes. Over 55 lakh students rely on UrbanPro.com, to fulfill their learning requirements across 1,000+ categories. Using UrbanPro.com, parents, and students can compare multiple Tutors and Institutes and choose the one that best suits their requirements. More than 7.5 lakh verified Tutors and Institutes are helping millions of students every day and growing their tutoring business on UrbanPro.com. Whether you are looking for a tutor to learn mathematics, a German language trainer to brush up your German language skills or an institute to upgrade your IT skills, we have got the best selection of Tutors and Training Institutes for you. Read more