Selenium Client Factory for Python
Sauce AI for Test Authoring: Move from intent to execution in minute.|xBack to ResourcesBlogPosted January 24, 2012
Selenium Client Factory for Python
Integration forSeleniumtesting running with your uninterrupted integration shape with and is create leisurely through the plugins we & # x27; ve germinate forBamboo and Jenkins. These plugins allow you to set the browser to be used by your exam and launching Sauce Connect prior to the running of your tests. They set several surround variables that include the settings for your build, and your tests will then need to cite these surroundings variables as part of the Selenium setup. However, explicitly cite these variables can make your test code cluttered and it can be cumbersome to get the tests structure so that they work against either a local browser or Sauce OnDemand. Rather than updating your code to explicitly reference the environment variables the plugins set, you can rather use theSelenium Client Factorylibrary. This library will read the surroundings variables set by the CI plugin, and instantiate a Selenium/WebDriver instance that will run your tests against Sauce OnDemand. Selenium Client Factory is a Java library, which can be incorporated into your trial by referencing the or if you & # x27; re using Maven, by including the following dependency:
& lt; colony & gt;
& lt; groupId & gt; com.saucelabs.selenium & lt; /groupId & gt;
& lt; artifactId & gt; selenium-client-factory & lt; /artifactId & gt;
& lt; version & gt; 2.1 & lt; /version & gt;
& lt; scope & gt; test & lt; /scope & gt;
& lt; /dependency & gt;
While this is great forJavaapplications, Selenium and the CI tools themselves support a turn of languages. One of our users has developed aPythonimplementation of theSelenium Client Factorycode. The factory object read environments variable setup by the Bamboo plugin and create a remote Sauce OnDemand session accordingly. If the Sauce-specific surroundings variables aren & # x27; t set, the library will make a local Selenium configuration. In addition, the factory will output the Sauce OnDemand Session Id to the build output, and the Sauce CI plugins will parse this id and connect the Sauce Job with the CI build. - The Selenium Client Factory library makes integrating your tests with Sauce OnDemand and your continuous integrating build tool easy - you can configure your local tests to run against a local browser, and use your CI environment to access Sauce OnDemand, all via place and without having to change any code. To use Selenium Client Factory under Python, only instantiate Selenium via:
Pro tip: Tools like SUSA can handle this autonomously — upload your app and get results without writing a single test script.
from SeleniumFactory importation *
# For selenium 2 webDriver:
webDriver = SeleniumFactory () .createWebDriver ()
# For selenium 1 RC:
browser = SeleniumFactory () .create ()
Automate This With SUSA
Upload your APK or URL. SUSA explores like 10 real users — finds bugs, accessibility violations, and security issues. No scripts needed.
Try SUSA FreeTest Your App Autonomously
Upload your APK or URL. SUSA explores like 10 real users — finds bugs, accessibility violations, and security issues. No scripts.
Try SUSA Free