SlideShare ist ein Scribd-Unternehmen logo
1 von 18
By
Dwarika Dhish Mishra
Mob- 9999978609
Blog- http://abodeqa.wordpress.com
CSS
 CSS stands for Cascading style sheet
 This language is used to show the look and formatting

of documents written in markup language such in
HTML or XML
 CSS pattern matching principles are being used to
located element on webpage for further operations.
 CSS pattern are known as Selector that determines
which style is assigned to which element in DOM
Why CSS Selector in WebDriver
 CSS selector are faster than Xpath.
 In CSS selector we can move in forward direction while

in Xpath is bidirectional. Due to this CSS selector is
faster than Xpath
 Selenium’s By class also provide cssSelector() method
to locate element using CSS Selector
Some basic CSS Selector
 By using Absolute path
 By using relative path
 By using Class Selector
 By using ID selector

 By using attributes selectors
 By using attributes name selectors
 By using Pattern matching

 Nth-child
CSS selector by using absolute path
<html>
<body>
<form name="loginForm">
<label for="username">UserName: </label>
<input type="text" name="username" for="wow" /><br/>
<label for="password">Password: </label>
<input type="password" name="password" /><br/>
<input name="login" type="submit" value="Login" /> </form>
</body>
</html>
Continue…
 Absolute path of username text field would be

$$(“html>body>form>input:nth-of-type(1)”)
Then in selenium we could find the username text field
by using this line of code
WebElement username =
driver.findElement(By.cssSelector(“html>body>form>input:nth-oftype(1)”));
Relative path
$$(“input[name=username]”)
Line of code in WebDriver to locate this element is
WebElement username =
driver.findElement(By.cssSelector(“input[name=usern
ame]”));
Finding CSS selector using class
selector
 In general we have class as one attribute to HTML tags

through which we normally reach to web-element on
webpage
 So CSS selector syntax would be
[HTML][dot][value of class attribute]
Or
[dot][value of class attribute]
Continue
 If HTML source code is

<input type="text" class="username" for="wow" /><br/>
Then CSS Selector should be
Input.username
 Line of WebDriver code used to do action on this
element would be
WebElement username =
driver.findElement(By.cssSelector(“input.username”));
Finding CSS Selector using ID
selector
 Like Class, Id attribute is also used to find any element

uniquely
In this case CSS selector syntax would be
[HTML tag][hash][value of attribute]
Or
[hash][value of attribute]
Continue..
 If HTML source code would be

<input type="text" id="username" for="wow" /><br/>
Then line of WebDriver code would be
WebElement username =
driver.findElement(By.cssSelector(“input#username”))
;
Or
WebElement username =
driver.findElement(By.cssSelector(“#username”));
Finding CSS selector using various
attributes
 If HTML source code would be

<input type="text" id="username" for="wow" /><br/>
Then CSS selector would be
Input[id=username]
 Line of Webdriver code would be
WebElement username =
driver.findElement(By.cssSelector(“input#username”))
;
Pattern Matching
 Syntax for Starts with in CSS selector is

^= , CSS Selector would be written like this
Input[id^=‘user’]
Then it will return input tag with attribute id starting
with user.
Continue..
 Syntax for Ends with in CSS selector is

$= , CSS Selector would be written like this
Input[id$=‘name’]
Then it will return input tag with attribute id ending
with name word.
Continue..
 Syntax for Ends with in CSS selector is

*= , CSS Selector would be written like this
Input[id*=‘name’]
Then it will return input tag with attribute id containing
name word in its value.
Nth-child[index]
Syntax
*:nth-child[index]
By using this we can find any child of a parent using
index of that element.
There is another method used in CSS selector is :nth-oftype[index]
But this not supported in selenium webdriver.
Topic of next session
 Opening various browser and receiving URL in

navigation bar of browsers.
 TestNg java framework in WebDriver and use of its

annotations.
Thank you !!!

Weitere ähnliche Inhalte

Was ist angesagt?

Getting Started with jQuery
Getting Started with jQueryGetting Started with jQuery
Getting Started with jQueryAkshay Mathur
 
Html / CSS Presentation
Html / CSS PresentationHtml / CSS Presentation
Html / CSS PresentationShawn Calvert
 
CSC103 Web Technologies: HTML, CSS, JS
CSC103 Web Technologies: HTML, CSS, JSCSC103 Web Technologies: HTML, CSS, JS
CSC103 Web Technologies: HTML, CSS, JSRichard Homa
 
Intro to Javascript and jQuery
Intro to Javascript and jQueryIntro to Javascript and jQuery
Intro to Javascript and jQueryShawn Calvert
 
Class Intro / HTML Basics
Class Intro / HTML BasicsClass Intro / HTML Basics
Class Intro / HTML BasicsShawn Calvert
 
Web Development Basics: HOW TO in HTML
Web Development Basics: HOW TO in HTMLWeb Development Basics: HOW TO in HTML
Web Development Basics: HOW TO in HTMLDer Lo
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQueryZeeshan Khan
 
Introduction to html & css
Introduction to html & cssIntroduction to html & css
Introduction to html & csssesharao puvvada
 
FFW Gabrovo PMG - HTML
FFW Gabrovo PMG - HTMLFFW Gabrovo PMG - HTML
FFW Gabrovo PMG - HTMLToni Kolev
 
CSS for basic learner
CSS for basic learnerCSS for basic learner
CSS for basic learnerYoeung Vibol
 

Was ist angesagt? (18)

Getting Started with jQuery
Getting Started with jQueryGetting Started with jQuery
Getting Started with jQuery
 
Html / CSS Presentation
Html / CSS PresentationHtml / CSS Presentation
Html / CSS Presentation
 
Css3 Presetation
Css3 PresetationCss3 Presetation
Css3 Presetation
 
CSC103 Web Technologies: HTML, CSS, JS
CSC103 Web Technologies: HTML, CSS, JSCSC103 Web Technologies: HTML, CSS, JS
CSC103 Web Technologies: HTML, CSS, JS
 
Css locators
Css locatorsCss locators
Css locators
 
Intro to jQuery
Intro to jQueryIntro to jQuery
Intro to jQuery
 
Intro to Javascript and jQuery
Intro to Javascript and jQueryIntro to Javascript and jQuery
Intro to Javascript and jQuery
 
Class Intro / HTML Basics
Class Intro / HTML BasicsClass Intro / HTML Basics
Class Intro / HTML Basics
 
Introduction to XML
Introduction to XMLIntroduction to XML
Introduction to XML
 
Web Development Basics: HOW TO in HTML
Web Development Basics: HOW TO in HTMLWeb Development Basics: HOW TO in HTML
Web Development Basics: HOW TO in HTML
 
Creative Web 2 - CSS
Creative Web 2 - CSS Creative Web 2 - CSS
Creative Web 2 - CSS
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQuery
 
Less css
Less cssLess css
Less css
 
Introduction to html & css
Introduction to html & cssIntroduction to html & css
Introduction to html & css
 
FFW Gabrovo PMG - HTML
FFW Gabrovo PMG - HTMLFFW Gabrovo PMG - HTML
FFW Gabrovo PMG - HTML
 
Jquery
JqueryJquery
Jquery
 
Unit 4(it workshop)
Unit 4(it workshop)Unit 4(it workshop)
Unit 4(it workshop)
 
CSS for basic learner
CSS for basic learnerCSS for basic learner
CSS for basic learner
 

Andere mochten auch

Introduction To Web Technology
Introduction To Web TechnologyIntroduction To Web Technology
Introduction To Web TechnologyArun Kumar
 
Web technologies lesson 1
Web technologies   lesson 1Web technologies   lesson 1
Web technologies lesson 1nhepner
 
Introduction to Web Technology
Introduction to Web TechnologyIntroduction to Web Technology
Introduction to Web TechnologyAashish Jain
 
introduction to web technology
introduction to web technologyintroduction to web technology
introduction to web technologyvikram singh
 

Andere mochten auch (6)

Automation for developers
Automation for developersAutomation for developers
Automation for developers
 
Wso2 test automation framework internal training
Wso2 test automation framework internal trainingWso2 test automation framework internal training
Wso2 test automation framework internal training
 
Introduction To Web Technology
Introduction To Web TechnologyIntroduction To Web Technology
Introduction To Web Technology
 
Web technologies lesson 1
Web technologies   lesson 1Web technologies   lesson 1
Web technologies lesson 1
 
Introduction to Web Technology
Introduction to Web TechnologyIntroduction to Web Technology
Introduction to Web Technology
 
introduction to web technology
introduction to web technologyintroduction to web technology
introduction to web technology
 

Ähnlich wie Css selector - BNT 11

How to use CSS Selector to identify Web Elements for selenium scripts
How to use CSS Selector to identify Web Elements for selenium scriptsHow to use CSS Selector to identify Web Elements for selenium scripts
How to use CSS Selector to identify Web Elements for selenium scriptsSokunthaneth Chhoy
 
CSS Selector in Selenium WebDriver | Edureka
CSS Selector in Selenium WebDriver | EdurekaCSS Selector in Selenium WebDriver | Edureka
CSS Selector in Selenium WebDriver | EdurekaEdureka!
 
𝗦𝗲𝗹𝗲𝗻𝗶𝘂𝗺 𝘂𝘀𝗶𝗻𝗴 𝗝𝗮𝘃𝗮.pdf
𝗦𝗲𝗹𝗲𝗻𝗶𝘂𝗺 𝘂𝘀𝗶𝗻𝗴 𝗝𝗮𝘃𝗮.pdf𝗦𝗲𝗹𝗲𝗻𝗶𝘂𝗺 𝘂𝘀𝗶𝗻𝗴 𝗝𝗮𝘃𝗮.pdf
𝗦𝗲𝗹𝗲𝗻𝗶𝘂𝗺 𝘂𝘀𝗶𝗻𝗴 𝗝𝗮𝘃𝗮.pdfsinghsibasis2
 
Understanding CSS Selectors in Selenium.pdf
Understanding CSS Selectors in Selenium.pdfUnderstanding CSS Selectors in Selenium.pdf
Understanding CSS Selectors in Selenium.pdfpCloudy
 
CSS+Selector+Tutorial+Slides.pdf
CSS+Selector+Tutorial+Slides.pdfCSS+Selector+Tutorial+Slides.pdf
CSS+Selector+Tutorial+Slides.pdfkuppaidon
 
CSS: How To Learn Easily
CSS: How To Learn EasilyCSS: How To Learn Easily
CSS: How To Learn Easilyshabab shihan
 
J query b_dotnet_ug_meet_12_may_2012
J query b_dotnet_ug_meet_12_may_2012J query b_dotnet_ug_meet_12_may_2012
J query b_dotnet_ug_meet_12_may_2012ghnash
 
INFO3775 Chapter 2 Part 2
INFO3775 Chapter 2 Part 2INFO3775 Chapter 2 Part 2
INFO3775 Chapter 2 Part 2Jeff Byrnes
 
Styling Components with JavaScript: MelbCSS Edition
Styling Components with JavaScript: MelbCSS EditionStyling Components with JavaScript: MelbCSS Edition
Styling Components with JavaScript: MelbCSS Editionbensmithett
 
Web Programming& Scripting Lab
Web Programming& Scripting LabWeb Programming& Scripting Lab
Web Programming& Scripting LabSwapnali Pawar
 
HTML and CSS crash course!
HTML and CSS crash course!HTML and CSS crash course!
HTML and CSS crash course!Ana Cidre
 
Caffeinated Style Sheets
Caffeinated Style SheetsCaffeinated Style Sheets
Caffeinated Style SheetsTommy Hodgins
 
ST LAB 15 (1).docx
ST LAB 15 (1).docxST LAB 15 (1).docx
ST LAB 15 (1).docxAfrasAhmad3
 
ST LAB 15 (1).docx
ST LAB 15 (1).docxST LAB 15 (1).docx
ST LAB 15 (1).docxAfrasAhmad3
 

Ähnlich wie Css selector - BNT 11 (20)

How to use CSS Selector to identify Web Elements for selenium scripts
How to use CSS Selector to identify Web Elements for selenium scriptsHow to use CSS Selector to identify Web Elements for selenium scripts
How to use CSS Selector to identify Web Elements for selenium scripts
 
CSS Selector in Selenium WebDriver | Edureka
CSS Selector in Selenium WebDriver | EdurekaCSS Selector in Selenium WebDriver | Edureka
CSS Selector in Selenium WebDriver | Edureka
 
𝗦𝗲𝗹𝗲𝗻𝗶𝘂𝗺 𝘂𝘀𝗶𝗻𝗴 𝗝𝗮𝘃𝗮.pdf
𝗦𝗲𝗹𝗲𝗻𝗶𝘂𝗺 𝘂𝘀𝗶𝗻𝗴 𝗝𝗮𝘃𝗮.pdf𝗦𝗲𝗹𝗲𝗻𝗶𝘂𝗺 𝘂𝘀𝗶𝗻𝗴 𝗝𝗮𝘃𝗮.pdf
𝗦𝗲𝗹𝗲𝗻𝗶𝘂𝗺 𝘂𝘀𝗶𝗻𝗴 𝗝𝗮𝘃𝗮.pdf
 
Understanding CSS Selectors in Selenium.pdf
Understanding CSS Selectors in Selenium.pdfUnderstanding CSS Selectors in Selenium.pdf
Understanding CSS Selectors in Selenium.pdf
 
CSS+Selector+Tutorial+Slides.pdf
CSS+Selector+Tutorial+Slides.pdfCSS+Selector+Tutorial+Slides.pdf
CSS+Selector+Tutorial+Slides.pdf
 
CSS: How To Learn Easily
CSS: How To Learn EasilyCSS: How To Learn Easily
CSS: How To Learn Easily
 
Cascading Style Sheets
Cascading Style SheetsCascading Style Sheets
Cascading Style Sheets
 
J query b_dotnet_ug_meet_12_may_2012
J query b_dotnet_ug_meet_12_may_2012J query b_dotnet_ug_meet_12_may_2012
J query b_dotnet_ug_meet_12_may_2012
 
INFO3775 Chapter 2 Part 2
INFO3775 Chapter 2 Part 2INFO3775 Chapter 2 Part 2
INFO3775 Chapter 2 Part 2
 
Cascstylesheets
CascstylesheetsCascstylesheets
Cascstylesheets
 
Styling Components with JavaScript: MelbCSS Edition
Styling Components with JavaScript: MelbCSS EditionStyling Components with JavaScript: MelbCSS Edition
Styling Components with JavaScript: MelbCSS Edition
 
Web Programming& Scripting Lab
Web Programming& Scripting LabWeb Programming& Scripting Lab
Web Programming& Scripting Lab
 
HTML and CSS crash course!
HTML and CSS crash course!HTML and CSS crash course!
HTML and CSS crash course!
 
Caffeinated Style Sheets
Caffeinated Style SheetsCaffeinated Style Sheets
Caffeinated Style Sheets
 
Rational HATS and CSS
Rational HATS and CSSRational HATS and CSS
Rational HATS and CSS
 
Cascading Style Sheet
Cascading Style SheetCascading Style Sheet
Cascading Style Sheet
 
CSS
CSSCSS
CSS
 
Css3
Css3Css3
Css3
 
ST LAB 15 (1).docx
ST LAB 15 (1).docxST LAB 15 (1).docx
ST LAB 15 (1).docx
 
ST LAB 15 (1).docx
ST LAB 15 (1).docxST LAB 15 (1).docx
ST LAB 15 (1).docx
 

Kürzlich hochgeladen

Call Girl Nashik Amaira 7001305949 Independent Escort Service Nashik
Call Girl Nashik Amaira 7001305949 Independent Escort Service NashikCall Girl Nashik Amaira 7001305949 Independent Escort Service Nashik
Call Girl Nashik Amaira 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
Call Girl Nashik Saloni 7001305949 Independent Escort Service Nashik
Call Girl Nashik Saloni 7001305949 Independent Escort Service NashikCall Girl Nashik Saloni 7001305949 Independent Escort Service Nashik
Call Girl Nashik Saloni 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
↑Top Model (Kolkata) Call Girls Sonagachi ⟟ 8250192130 ⟟ High Class Call Girl...
↑Top Model (Kolkata) Call Girls Sonagachi ⟟ 8250192130 ⟟ High Class Call Girl...↑Top Model (Kolkata) Call Girls Sonagachi ⟟ 8250192130 ⟟ High Class Call Girl...
↑Top Model (Kolkata) Call Girls Sonagachi ⟟ 8250192130 ⟟ High Class Call Girl...noor ahmed
 
Independent Hatiara Escorts ✔ 8250192130 ✔ Full Night With Room Online Bookin...
Independent Hatiara Escorts ✔ 8250192130 ✔ Full Night With Room Online Bookin...Independent Hatiara Escorts ✔ 8250192130 ✔ Full Night With Room Online Bookin...
Independent Hatiara Escorts ✔ 8250192130 ✔ Full Night With Room Online Bookin...Riya Pathan
 
Karnal Call Girls 8860008073 Dyal Singh Colony Call Girls Service in Karnal E...
Karnal Call Girls 8860008073 Dyal Singh Colony Call Girls Service in Karnal E...Karnal Call Girls 8860008073 Dyal Singh Colony Call Girls Service in Karnal E...
Karnal Call Girls 8860008073 Dyal Singh Colony Call Girls Service in Karnal E...Apsara Of India
 
Book Call Girls in Panchpota - 8250192130 | 24x7 Service Available Near Me
Book Call Girls in Panchpota - 8250192130 | 24x7 Service Available Near MeBook Call Girls in Panchpota - 8250192130 | 24x7 Service Available Near Me
Book Call Girls in Panchpota - 8250192130 | 24x7 Service Available Near Meanamikaraghav4
 
Call Girls Service Bantala - Call 8250192130 Rs-3500 with A/C Room Cash on De...
Call Girls Service Bantala - Call 8250192130 Rs-3500 with A/C Room Cash on De...Call Girls Service Bantala - Call 8250192130 Rs-3500 with A/C Room Cash on De...
Call Girls Service Bantala - Call 8250192130 Rs-3500 with A/C Room Cash on De...anamikaraghav4
 
(KRITI) Pimpri Chinchwad Call Girls Just Call 7001035870 [ Cash on Delivery ]...
(KRITI) Pimpri Chinchwad Call Girls Just Call 7001035870 [ Cash on Delivery ]...(KRITI) Pimpri Chinchwad Call Girls Just Call 7001035870 [ Cash on Delivery ]...
(KRITI) Pimpri Chinchwad Call Girls Just Call 7001035870 [ Cash on Delivery ]...ranjana rawat
 
Beautiful 😋 Call girls in Lahore 03210033448
Beautiful 😋 Call girls in Lahore 03210033448Beautiful 😋 Call girls in Lahore 03210033448
Beautiful 😋 Call girls in Lahore 03210033448ont65320
 
↑Top Model (Kolkata) Call Girls Rajpur ⟟ 8250192130 ⟟ High Class Call Girl In...
↑Top Model (Kolkata) Call Girls Rajpur ⟟ 8250192130 ⟟ High Class Call Girl In...↑Top Model (Kolkata) Call Girls Rajpur ⟟ 8250192130 ⟟ High Class Call Girl In...
↑Top Model (Kolkata) Call Girls Rajpur ⟟ 8250192130 ⟟ High Class Call Girl In...noor ahmed
 
Call Girls In Goa 9316020077 Goa Call Girl By Indian Call Girls Goa
Call Girls In Goa  9316020077 Goa  Call Girl By Indian Call Girls GoaCall Girls In Goa  9316020077 Goa  Call Girl By Indian Call Girls Goa
Call Girls In Goa 9316020077 Goa Call Girl By Indian Call Girls Goasexy call girls service in goa
 
Low Rate Call Girls Gulbarga Anika 8250192130 Independent Escort Service Gulb...
Low Rate Call Girls Gulbarga Anika 8250192130 Independent Escort Service Gulb...Low Rate Call Girls Gulbarga Anika 8250192130 Independent Escort Service Gulb...
Low Rate Call Girls Gulbarga Anika 8250192130 Independent Escort Service Gulb...Riya Pathan
 
VIP Call Girls Darjeeling Aaradhya 8250192130 Independent Escort Service Darj...
VIP Call Girls Darjeeling Aaradhya 8250192130 Independent Escort Service Darj...VIP Call Girls Darjeeling Aaradhya 8250192130 Independent Escort Service Darj...
VIP Call Girls Darjeeling Aaradhya 8250192130 Independent Escort Service Darj...Neha Kaur
 
VIP Call Girls Service Banjara Hills Hyderabad Call +91-8250192130
VIP Call Girls Service Banjara Hills Hyderabad Call +91-8250192130VIP Call Girls Service Banjara Hills Hyderabad Call +91-8250192130
VIP Call Girls Service Banjara Hills Hyderabad Call +91-8250192130Suhani Kapoor
 
Verified Call Girls Esplanade - [ Cash on Delivery ] Contact 8250192130 Escor...
Verified Call Girls Esplanade - [ Cash on Delivery ] Contact 8250192130 Escor...Verified Call Girls Esplanade - [ Cash on Delivery ] Contact 8250192130 Escor...
Verified Call Girls Esplanade - [ Cash on Delivery ] Contact 8250192130 Escor...anamikaraghav4
 
Low Rate Call Girls Ajmer Anika 8250192130 Independent Escort Service Ajmer
Low Rate Call Girls Ajmer Anika 8250192130 Independent Escort Service AjmerLow Rate Call Girls Ajmer Anika 8250192130 Independent Escort Service Ajmer
Low Rate Call Girls Ajmer Anika 8250192130 Independent Escort Service AjmerRiya Pathan
 
↑Top Model (Kolkata) Call Girls Howrah ⟟ 8250192130 ⟟ High Class Call Girl In...
↑Top Model (Kolkata) Call Girls Howrah ⟟ 8250192130 ⟟ High Class Call Girl In...↑Top Model (Kolkata) Call Girls Howrah ⟟ 8250192130 ⟟ High Class Call Girl In...
↑Top Model (Kolkata) Call Girls Howrah ⟟ 8250192130 ⟟ High Class Call Girl In...noor ahmed
 
Call Girl Nagpur Roshni Call 7001035870 Meet With Nagpur Escorts
Call Girl Nagpur Roshni Call 7001035870 Meet With Nagpur EscortsCall Girl Nagpur Roshni Call 7001035870 Meet With Nagpur Escorts
Call Girl Nagpur Roshni Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 

Kürzlich hochgeladen (20)

Call Girl Nashik Amaira 7001305949 Independent Escort Service Nashik
Call Girl Nashik Amaira 7001305949 Independent Escort Service NashikCall Girl Nashik Amaira 7001305949 Independent Escort Service Nashik
Call Girl Nashik Amaira 7001305949 Independent Escort Service Nashik
 
Call Girl Nashik Saloni 7001305949 Independent Escort Service Nashik
Call Girl Nashik Saloni 7001305949 Independent Escort Service NashikCall Girl Nashik Saloni 7001305949 Independent Escort Service Nashik
Call Girl Nashik Saloni 7001305949 Independent Escort Service Nashik
 
↑Top Model (Kolkata) Call Girls Sonagachi ⟟ 8250192130 ⟟ High Class Call Girl...
↑Top Model (Kolkata) Call Girls Sonagachi ⟟ 8250192130 ⟟ High Class Call Girl...↑Top Model (Kolkata) Call Girls Sonagachi ⟟ 8250192130 ⟟ High Class Call Girl...
↑Top Model (Kolkata) Call Girls Sonagachi ⟟ 8250192130 ⟟ High Class Call Girl...
 
Independent Hatiara Escorts ✔ 8250192130 ✔ Full Night With Room Online Bookin...
Independent Hatiara Escorts ✔ 8250192130 ✔ Full Night With Room Online Bookin...Independent Hatiara Escorts ✔ 8250192130 ✔ Full Night With Room Online Bookin...
Independent Hatiara Escorts ✔ 8250192130 ✔ Full Night With Room Online Bookin...
 
Karnal Call Girls 8860008073 Dyal Singh Colony Call Girls Service in Karnal E...
Karnal Call Girls 8860008073 Dyal Singh Colony Call Girls Service in Karnal E...Karnal Call Girls 8860008073 Dyal Singh Colony Call Girls Service in Karnal E...
Karnal Call Girls 8860008073 Dyal Singh Colony Call Girls Service in Karnal E...
 
Goa Call Girls 9316020077 Call Girls In Goa By Russian Call Girl in goa
Goa Call Girls 9316020077 Call Girls  In Goa By Russian Call Girl in goaGoa Call Girls 9316020077 Call Girls  In Goa By Russian Call Girl in goa
Goa Call Girls 9316020077 Call Girls In Goa By Russian Call Girl in goa
 
Book Call Girls in Panchpota - 8250192130 | 24x7 Service Available Near Me
Book Call Girls in Panchpota - 8250192130 | 24x7 Service Available Near MeBook Call Girls in Panchpota - 8250192130 | 24x7 Service Available Near Me
Book Call Girls in Panchpota - 8250192130 | 24x7 Service Available Near Me
 
Call Girls Service Bantala - Call 8250192130 Rs-3500 with A/C Room Cash on De...
Call Girls Service Bantala - Call 8250192130 Rs-3500 with A/C Room Cash on De...Call Girls Service Bantala - Call 8250192130 Rs-3500 with A/C Room Cash on De...
Call Girls Service Bantala - Call 8250192130 Rs-3500 with A/C Room Cash on De...
 
(KRITI) Pimpri Chinchwad Call Girls Just Call 7001035870 [ Cash on Delivery ]...
(KRITI) Pimpri Chinchwad Call Girls Just Call 7001035870 [ Cash on Delivery ]...(KRITI) Pimpri Chinchwad Call Girls Just Call 7001035870 [ Cash on Delivery ]...
(KRITI) Pimpri Chinchwad Call Girls Just Call 7001035870 [ Cash on Delivery ]...
 
Beautiful 😋 Call girls in Lahore 03210033448
Beautiful 😋 Call girls in Lahore 03210033448Beautiful 😋 Call girls in Lahore 03210033448
Beautiful 😋 Call girls in Lahore 03210033448
 
↑Top Model (Kolkata) Call Girls Rajpur ⟟ 8250192130 ⟟ High Class Call Girl In...
↑Top Model (Kolkata) Call Girls Rajpur ⟟ 8250192130 ⟟ High Class Call Girl In...↑Top Model (Kolkata) Call Girls Rajpur ⟟ 8250192130 ⟟ High Class Call Girl In...
↑Top Model (Kolkata) Call Girls Rajpur ⟟ 8250192130 ⟟ High Class Call Girl In...
 
Call Girls In Goa 9316020077 Goa Call Girl By Indian Call Girls Goa
Call Girls In Goa  9316020077 Goa  Call Girl By Indian Call Girls GoaCall Girls In Goa  9316020077 Goa  Call Girl By Indian Call Girls Goa
Call Girls In Goa 9316020077 Goa Call Girl By Indian Call Girls Goa
 
Low Rate Call Girls Gulbarga Anika 8250192130 Independent Escort Service Gulb...
Low Rate Call Girls Gulbarga Anika 8250192130 Independent Escort Service Gulb...Low Rate Call Girls Gulbarga Anika 8250192130 Independent Escort Service Gulb...
Low Rate Call Girls Gulbarga Anika 8250192130 Independent Escort Service Gulb...
 
Call Girls South Avenue Delhi WhatsApp Number 9711199171
Call Girls South Avenue Delhi WhatsApp Number 9711199171Call Girls South Avenue Delhi WhatsApp Number 9711199171
Call Girls South Avenue Delhi WhatsApp Number 9711199171
 
VIP Call Girls Darjeeling Aaradhya 8250192130 Independent Escort Service Darj...
VIP Call Girls Darjeeling Aaradhya 8250192130 Independent Escort Service Darj...VIP Call Girls Darjeeling Aaradhya 8250192130 Independent Escort Service Darj...
VIP Call Girls Darjeeling Aaradhya 8250192130 Independent Escort Service Darj...
 
VIP Call Girls Service Banjara Hills Hyderabad Call +91-8250192130
VIP Call Girls Service Banjara Hills Hyderabad Call +91-8250192130VIP Call Girls Service Banjara Hills Hyderabad Call +91-8250192130
VIP Call Girls Service Banjara Hills Hyderabad Call +91-8250192130
 
Verified Call Girls Esplanade - [ Cash on Delivery ] Contact 8250192130 Escor...
Verified Call Girls Esplanade - [ Cash on Delivery ] Contact 8250192130 Escor...Verified Call Girls Esplanade - [ Cash on Delivery ] Contact 8250192130 Escor...
Verified Call Girls Esplanade - [ Cash on Delivery ] Contact 8250192130 Escor...
 
Low Rate Call Girls Ajmer Anika 8250192130 Independent Escort Service Ajmer
Low Rate Call Girls Ajmer Anika 8250192130 Independent Escort Service AjmerLow Rate Call Girls Ajmer Anika 8250192130 Independent Escort Service Ajmer
Low Rate Call Girls Ajmer Anika 8250192130 Independent Escort Service Ajmer
 
↑Top Model (Kolkata) Call Girls Howrah ⟟ 8250192130 ⟟ High Class Call Girl In...
↑Top Model (Kolkata) Call Girls Howrah ⟟ 8250192130 ⟟ High Class Call Girl In...↑Top Model (Kolkata) Call Girls Howrah ⟟ 8250192130 ⟟ High Class Call Girl In...
↑Top Model (Kolkata) Call Girls Howrah ⟟ 8250192130 ⟟ High Class Call Girl In...
 
Call Girl Nagpur Roshni Call 7001035870 Meet With Nagpur Escorts
Call Girl Nagpur Roshni Call 7001035870 Meet With Nagpur EscortsCall Girl Nagpur Roshni Call 7001035870 Meet With Nagpur Escorts
Call Girl Nagpur Roshni Call 7001035870 Meet With Nagpur Escorts
 

Css selector - BNT 11

  • 1. By Dwarika Dhish Mishra Mob- 9999978609 Blog- http://abodeqa.wordpress.com
  • 2. CSS  CSS stands for Cascading style sheet  This language is used to show the look and formatting of documents written in markup language such in HTML or XML  CSS pattern matching principles are being used to located element on webpage for further operations.  CSS pattern are known as Selector that determines which style is assigned to which element in DOM
  • 3. Why CSS Selector in WebDriver  CSS selector are faster than Xpath.  In CSS selector we can move in forward direction while in Xpath is bidirectional. Due to this CSS selector is faster than Xpath  Selenium’s By class also provide cssSelector() method to locate element using CSS Selector
  • 4. Some basic CSS Selector  By using Absolute path  By using relative path  By using Class Selector  By using ID selector  By using attributes selectors  By using attributes name selectors  By using Pattern matching  Nth-child
  • 5. CSS selector by using absolute path <html> <body> <form name="loginForm"> <label for="username">UserName: </label> <input type="text" name="username" for="wow" /><br/> <label for="password">Password: </label> <input type="password" name="password" /><br/> <input name="login" type="submit" value="Login" /> </form> </body> </html>
  • 6. Continue…  Absolute path of username text field would be $$(“html>body>form>input:nth-of-type(1)”) Then in selenium we could find the username text field by using this line of code WebElement username = driver.findElement(By.cssSelector(“html>body>form>input:nth-oftype(1)”));
  • 7. Relative path $$(“input[name=username]”) Line of code in WebDriver to locate this element is WebElement username = driver.findElement(By.cssSelector(“input[name=usern ame]”));
  • 8. Finding CSS selector using class selector  In general we have class as one attribute to HTML tags through which we normally reach to web-element on webpage  So CSS selector syntax would be [HTML][dot][value of class attribute] Or [dot][value of class attribute]
  • 9. Continue  If HTML source code is <input type="text" class="username" for="wow" /><br/> Then CSS Selector should be Input.username  Line of WebDriver code used to do action on this element would be WebElement username = driver.findElement(By.cssSelector(“input.username”));
  • 10. Finding CSS Selector using ID selector  Like Class, Id attribute is also used to find any element uniquely In this case CSS selector syntax would be [HTML tag][hash][value of attribute] Or [hash][value of attribute]
  • 11. Continue..  If HTML source code would be <input type="text" id="username" for="wow" /><br/> Then line of WebDriver code would be WebElement username = driver.findElement(By.cssSelector(“input#username”)) ; Or WebElement username = driver.findElement(By.cssSelector(“#username”));
  • 12. Finding CSS selector using various attributes  If HTML source code would be <input type="text" id="username" for="wow" /><br/> Then CSS selector would be Input[id=username]  Line of Webdriver code would be WebElement username = driver.findElement(By.cssSelector(“input#username”)) ;
  • 13. Pattern Matching  Syntax for Starts with in CSS selector is ^= , CSS Selector would be written like this Input[id^=‘user’] Then it will return input tag with attribute id starting with user.
  • 14. Continue..  Syntax for Ends with in CSS selector is $= , CSS Selector would be written like this Input[id$=‘name’] Then it will return input tag with attribute id ending with name word.
  • 15. Continue..  Syntax for Ends with in CSS selector is *= , CSS Selector would be written like this Input[id*=‘name’] Then it will return input tag with attribute id containing name word in its value.
  • 16. Nth-child[index] Syntax *:nth-child[index] By using this we can find any child of a parent using index of that element. There is another method used in CSS selector is :nth-oftype[index] But this not supported in selenium webdriver.
  • 17. Topic of next session  Opening various browser and receiving URL in navigation bar of browsers.  TestNg java framework in WebDriver and use of its annotations.