Git Product home page Git Product logo

bubdm / selenium.helpers Goto Github PK

View Code? Open in Web Editor NEW

This project forked from roysbailey/selenium.helpers

0.0 0.0 0.0 13 KB

Following a dreadful experience testing a COTS web product with Selenium, and trying to work out the IDs for html elements nested in literally dozens of frames and iframes, I wrote this project to encapsulate some of the heavy lifting, with a generous sprinkling of recursion.

C# 79.05% HTML 20.95%

selenium.helpers's Introduction

Selenium.RecursiveElement.Sample

Following a nightmare experience testing a COTS website which was riddled with nested frames and iframes I decided to write a simple helper to ease the pain of trying to work back the frame / iframe ancestory for every element I needed to access, and then having to litter my POM classes with lots of SwitchTo().Frame("XYZ").

So, I developed the an extension method to complement the existing FindElement method. The new method is called FindElementRecursive. The method signature is identical to the original, and the only difference is that the extension method recursively iterates over all frames and iframes until it finds a match.

Obviously, if you have the same element (ID) in > 1 frame, it will match the first one, which may not be what you want. We found such instances to be few and far between in our use case, but if you do hit that issue, you are back to the "out the box" Selenium option (and switching frames yourself)

The Solution includes three Projects:

  • Selenium.Helpers - this contains the FindElementRecursive extension method
  • WebSitePOM - the Page Object Model (to provide a clean, Selenium free interface to the test project)
  • Tests - MSTest sample test which uses a local "test website" (under "sut" folder) to show how it works with Frames and IFrames.

Enjoy!

selenium.helpers's People

Contributors

roysbailey avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.