Hopefully you were able to attend our Selenium 201 class a couple weeks back to learn some best practices when it comes to automating your tests with Selenium.
Or if you couldn’t attend, not to worry! We had a very engaged Live Q&A session at the end of our webinar and we’re going to highlight the top questions that we’re asked.
What’s the benefit of using Selenium with CrossBrowserTesting?
As you look to expand your test coverage and want to run mores tests in parallel, a tool like CrossBrowserTesting is priceless. It allows you to direct your Selenium scripts to CrossBrowserTesting and run those tests against our +2050 real desktop and mobile browsers. You can gather more test results while executing the same scripts. CrossBrowserTesting can also capture full-scale videos, screenshots, and network captures.
Can we find any element on a web page without using By?
There are convenience methods called FindElementByID, FindElementByName, etc. These convenience methods actually just use By internally, so you’re essentially doing the same thing!
What’s the Pros and Cons of using By vs FindBy?
If you’re asking for the Pros and Cons between using the By class and the convenience methods provided by WebDriver, they are really one in the same, and you’ll often see both used. I suppose if you’re using the By class, changing a locator would mean changing just the parameters passed rather than the whole function call. The convenience methods just use By under the hood.
Can you integrate Selenium with BDD?
Absolutely! Selenium tests are a great, and a very common use-case for BDD scripts. We have examples using Cucumber here: Selenium CucumberJS
Are implicit waits applied to all the web elements on the page and explicit for only one element at a time?
Sort of, but not necessarily. Implicit waits are defined, then used automatically, for many or all commands in a test. The same explicit wait could be used for multiple ‘find’ commands, however it must be called explicitly each time.
Can we integrate Selenium test’s with Zephyr?
Yes, definitely! Check out our documented integration here: Zephyr Integration
Selenium vs Cypress? Which one is better?
Cypress is a great tool and even offers a few really intriguing features over Selenium. Sadly, Cypress currently only supports Chrome through the Desktop, so no mobile testing and no cross-browser support (yet). It also runs within the native browser context, rather than as a process against a browser run time, so remote support doesn’t quite make sense. Which one is better? It depends on your use-case. If you’re looking for a tool that is highly parallel, provides cross-browser support, mobile support, and has a huge user base ready to help with tons of documentation, Selenium has got you covered.
How do you handle the POM when the objects increase over time?
This question isn’t specific to just Page-Object-Model, it could be asked of Object-Oriented Programming in general. My answer would be to look for opportunities to refactor. Over time, you might find base functionality shared between two or more objects, duplicated code within an object, and things might generally start to get “smelly” as my professor used to say. In this case, break similar functionality out into new objects and employ inheritance when you can. Refactoring is essential to keep your code from getting out of control.
Can Selenium verify data in a database and do I want to do that?
Selenium doesn’t, but your scripts can. That is to say, your scripts will be able to communicate with your database independent of Selenium. The reason for this is that Selenium, by default, communicates with the browser over HTTP. That means, even when its running against a remote service like CrossBrowserTesting, the script process is still running in your environment and can access your database, should you choose to do so.
Be on the look out for our Selenium Academy 301 class!