CSS Selector | How To Write Custom CSS Selectors In Selenium Webdriver | CSS Selector Example

preview_player
Показать описание

Welcome to Day 12 on Teach Yourself Test Automation and it's day 12 of me teaching myself selenuim webdriver with Java

Day 12 is about How To Write Custom Css Selectors In Selenium Webdriver

CSS Selector is just as powerful as using XPath

Most experts and colleagues I have spoken to at work have preferred using Xpath to locate and interact with elements or objects on a web page or for automating test scripts

Again you can use the web browser tool to generate your CSS selector by inspecting the element and navigating to copy css selector option and you should have your css selector for that object copied to your clip board to be used later

However, for all web pages the browser tool might not bring back a reliable css selector or might return a dynamic css selector which will change each time your web page refrehes hence will not be a good ideal to use

So with the above in mind it's a good idea learning how to customized your own css selector

Go ahead and substitue tagname and attributes off your HTML code for your inspected web object into you css selector syntax

Now you can use your customized css selector in your eclipse as you script your automated test cases

--------------------------------------------------------------------------------------------------------
#testautomation #teachyourselftestautomation #selenium #webdriver #java
--------------------------------------------------------------------------------------------------------
Follow me @
--------------------------------------------------------------------------------------------------------
My Videos:
-------------------------------------------------------------------------------------------------------
Рекомендации по теме
Комментарии
Автор

Thank you sir, very informative video to learn CSS Selector. These days I am hearing a lot about SelectorsHub CSS Selector tool, hows that tool sir?

testtesting
welcome to shbcf.ru