SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 6 of 6
  1. #1
    Apprentice
    Join Date
    Nov 2006
    Location
    Denmark
    Posts
    23
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Selenium - must reads?

    Hi,
    After many (17 or is it 18 ...really..??) years in testing I now got the taks of doing some test automation with Selenium.
    I would like to know if you could recommend some must-reads for learning about Selenium?
    Especially the part about locating those webelements is confussing me/giving me headache.
    I supose others have had the same ...eeeh experience, so hoping someone has some good must-reads to share :-)
    Thank you very much,
    Jesper

  2. #2
    SQA Knight
    Join Date
    May 2006
    Location
    Playa Del Rey, California, United States
    Posts
    2,635
    Post Thanks / Like
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    Total Downloaded
    0
    On the locating web elements, there are 3 essential skills that will help you that is outside of Selenium.

    There are 2 main ways of locating web elements in general, XPath and CSS Selectors. Selenium gives you other selectors like 'name', 'tag', 'link_text', etc... But really XPath and CSS selectors are all you need, these 2 selectors are the selectors that Developers use to find elements. You might of seen JQuery code that reads like $('tagname.classname etc...'), or document.querySelector(), that is CSS at work. The 2nd is XPath, not so popular now, it's commonly used to navigate XML. I would learn to use those 2. Between those 2, you can select almost any element. (the exception is custom drawn canvas elements, or things inside plugins such as Flash or Silverlight)

    The 2nd thing to learn about finding web elements is to learn to use Chrome, Safari, Firefox's developer tools menus, then simplifying the expression. They have ways to locate elements, and you can get the full CSS or Xpath of an element. But the trick is, those xpaths or CSS generated is volatile. You'll want to learn the art of simplifying your xpath or CSS selectors. Here's one I wrote about XPath, Engineering Quality: 3 Useful Techniques to shortening your xpath Here's an article that'll help you with CSS, Writing efficient CSS selectors ? CSS Wizardry ? CSS, OOCSS, front-end architecture, performance and more, by Harry Roberts

    The 3rd concept is knowing the context where your element exists. For any given context, you'll have to learn how to switch selenium's context to that type. An element can exist in the following places:

    *Common
    - On the current DOM (no switching needed)
    - Within a Frame or Iframe Element, you need to switch frame context.
    - A popup window, you need to switch window context
    - Within a context of a embedded native browser plugin, like Flash or embedded video player. (this is a hard case to deal with, requires bridging or some plugin/extension to selenium)

    *Uncommon
    - Within a context a context of shadow dom (this is for more modern web frameworks like Polymer, not well supported by selenium yet, they almost operate like iframes, not seen mucn on production sites yet)
    - Within a context of an overlay created by a browser extension, such as the Pintrist browser extension. handle by switching window context.
    - Custom drawn on an SVG or canvas element. (you pretty much have to dig into the javascript and trigger things via JS injection.
    - As an image map, HTML map tag (this was how web GUIs were done a long time ago, almost extinct now), these have to be handled using hard coded coordinates.
    David Lai
    SDET / Consultant
    LinkedIn profile

  3. #3
    Advanced Member gencke's Avatar
    Join Date
    Feb 2008
    Location
    Seattle, Washington, United States
    Posts
    532
    Post Thanks / Like
    Mentioned
    3 Post(s)
    Tagged
    2 Thread(s)
    Total Downloaded
    0
    I came from a QTP/UFT backround and it took a little bit to get used to. (I never studied JAVA either before starting Selenium) I use xpath for the vast majority of object identification. I like the developer tools in Chrome. I just point at an object and I can copy the xpath id.
    Patience is like bread I say.... I ran out of that yesterday.

  4. #4
    Apprentice
    Join Date
    Nov 2006
    Location
    Denmark
    Posts
    23
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0
    Thank you very much for your replies.
    David, Thanks for very useful links :-)

  5. #5
    Member
    Join Date
    Jul 2007
    Posts
    71
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0
    @gencke, following post will suffice Java required to work with selenium,

    https://automation-performance.blogs...-selenium.html
    Last edited by avashistha; 10-12-2016 at 08:17 PM.

  6. #6
    Apprentice
    Join Date
    Feb 2016
    Location
    London
    Posts
    25
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 9.38%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2017 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 07:44 PM.

Copyright BetaSoft Inc.