CrossBrowserTesting.com

A Design, Development, Testing Blog

  • Product Overview
  • Pricing
  • Back Home
  • Free Trial
  • Design
  • Development
  • Manual Testing
  • Test Automation
  • Visual Testing

Selenium Academy 201 FAQ

September 12, 2019 By Chase Cook Leave a Comment

Selenium Academy 201 FAQ

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.

Between JavaScript & Python, which is better for automation with Selenium and why?

I’m normally not too picky about languages, but Python would be my pick in this scenario. I choose Python here simply because it’s a better fit for the synchronous nature of a Selenium test. You can absolutely do all of the same things in Node, and I have – Node is the language I write in primarily, but I think the asynchronous model applied by Node can actually make it more difficult to write Selenium tests. JavaScript and Python aren’t your only options either – Ruby and Java language bindings are also officially supported by the Selenium project, and there is third-party support for other languages.

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!

Filed Under: Test Automation Tagged With: FAQ, Selenium, Selenium 201

Selenium Academy 101 FAQ

August 7, 2019 By Nick Brown Leave a Comment

Selenium Academy 101 FAQ

With the conclusion of our very first Selenium Academy class we wanted to ensure we armed you with the answers to some of the most common questions that came up during our live QA session!

In our Selenium 101 class we started at the very beginning by explaining what Selenium is, why you will want to use Selenium for your UI testing and especially why you will want to use Selenium with CrossBrowserTesting. But let’s take a look at some of the most common questions that came up during last week’s webinar.

What is the difference between a Selenium grid and CrossBrowserTesting?

While you can make your own Selenium grid with a costly device lab or VMs, many have found moving their Selenium grid to a third-party cloud like CrossBrowserTesting is faster and more productive, allowing more tests to run on more machines in less time. With over 2050 browsers to choose from, the possibilities of parallel test execution with CrossBrowserTesting are almost limitless. Our browser, device, and operating system selection includes all the latest configurations as well as legacy browsers so you can test what your users are on without worrying about any of the associated costs or upkeep. There are certain real costs of building an in-house environment as well as countless other secondary costs of not going with a cloud provider, like CrossBrowserTesting.

Selenium is open source right, why would we need to buy CrossBrowserTesting?

We can give you 8 good reasons!

  1. We make it easier to get started.
  2. Just install Selenium bindings for your programming language of choice and be done!
  3. Eliminate the work of managing and maintaining Selenium Servers, WebDrivers, and Browsers
  4. Screenshots, videos, and even network data can be captured during a Selenium test and shared with anyone
  5. Higher concurrency means faster execution
  6. Run dozens of tests at once without having to run dozens of RAM-hungry browsers
  7. Spend less time waiting and more time doing what matters
  8. Instant access to thousands of browsers and devices, including mobiles

What languages are supported with Selenium?

C#, Java, JavaScript, PHP, Python and Ruby

Which language is the easiest to get started with?

When talking with users about what language is easiest to get started with, we always recommend Python. The reason we recommend it for beginners is because it reads like English and tends to be easier for users to understand when getting started. Take a look at our blog on the Best Programming Language to Learn First.

What’s the best way to set up tests to run within a build pipeline using Jenkins?

There are only two things you need to be able to run your selenium tests from a Jenkins pipeline. You need a shell script or batch file that Jenkins can call to start your test, and Jenkins needs access to any libraries or modules that you use during the test – including the Selenium language bindings. If you are using Python, you can use VirtualEnv to create a virtual environment for Python with Selenium already installed. If you are using Java, make sure to include Selenium in your pom.xml file and run mvn build.

Does Selenium have the ability to open two webpages at the same time?

Yes, Selenium can be used to easily manage multiple pages at the same time. You can use the built-in command “switch_to_window()” documented here: Learn More Here

Is it recommended to use find element by xpath always?

Quite the opposite. Using Xpath to find elements, especially absolute Xpaths, tends to lead to very brittle tests. Any small change in the hierarchy around the element you are locating could cause the wrong element to be selected. Those bugs in your Script can sometimes be hard to debug. You should save yourself the trouble and use element IDs as much as possible

So, find_element_by_id is the best function?

Yes, it’s the most resilient to change and the easiest to use. If you can, add human-understandable IDs to any elements of your page that you want to automate.

For AngularJS based applications, do you have any specific built in functionality?

CrossBrowserTesting does not provide specific functionality to test websites built with AngularJS, but CrossBrowserTesting does work with Protractor – a Selenium-based framework created by Google for testing AngularJS. We have a short guide on getting started here: Help Doc for Protractor

How well does protractor work with just regular Angular?

It works great! That’s what it’s made for. If you run into any problems, feel free to reach out to our support team and they’ll help get you up and running.

Want to register for our 201 class on August 27th? Register now!

Filed Under: Test Automation Tagged With: automated testing, automation, FAQ, Selenium, selenium 101

Try CrossBrowserTesting

Everything you need for testing on the web. Browsers & Devices included.


  • Grid In The Cloud
  • Simple CI Integrations
  • Native Debugging Tools
  • Real iOS and Android
  • 2050+ Browser/OS Combinations
  • Intuitive REST API

Start Testing Today

Want Testing Tips?

Want the latest tips & strategies from industry experts right to your inbox? Sign up below.
 

Join Over 600,000 Testers & Developers And Start Testing Today

Learn more Free Trial

Features

  • Live Testing
  • Selenium Automation
  • Automated Screenshots
  • Screenshot Comparison
  • Local Testing
  • Real Devices

Solutions

  • Automated Testing
  • Visual Testing
  • Manual Testing
  • Enterprise
  • Internet Explorer

Resources

  • Browsers & Devices
  • Blog
  • Webinars
  • Integrations
  • ROI Calculator

Company

  • About Us
  • Careers
  • Plans
  • Terms of use
  • Security

Support

  • Help Center
  • API Docs
  • Schedule A Demo
  • Contact Us
  • Write For Us