Posts

Showing posts from November, 2021

Selenium Webdriver Manager

Image
The simple way to connect the Webdriver is like that: 1 from selenium import webdriver 2 3 driver = webdriver.Chrome(<path_of_driver>) Const: We need to put all paths and their relative path. If the webdriver or the browser version change/update, we need to manually download him and replace it with the old one. A better way is to put the driver in venv folder, in that way the webdriver is available in all projects without writing the relative path. so... what is the easiest way to figure it out ? Meet webdriver manager, an alternative way to work with webdriver, It pulls the latest version from the central repository automatically. you just need to do two simple steps: Webdriver Manager The main idea of  webdriver_manager i s to simplify the management of binary drivers for different browsers. Instead of: Downloading binary chrome driver. Unzip it somewhere on your PC. Set path to this driver. Every time when there is a new version of the browser, we should repeat all tho...

Selenium - brief

Image
Selenium is an umbrella project (Open-Source) for a range of tools and libraries that enable and support the automation of web browsers. Selenium Modules: Selenium - IDE Selenium - RC Selenium - Webdriver Selenium - Grid Appium*   Selenium IDE The first project in selenium (2004), a t first, was only a firefox plugin for record tests. Records in 2004 were trash... if we would record 500 tests and something in my core application was a change, you should record from the beginning... Selenium RC (the second project, 2006) called Selenium 1 Now we could code our tests (with several languages) support with several browsers How ? They create Selenium RC Server (RC = Remote Control), the server translates the code from all those languages to the only language that the browsers know… JavaScript... Const: The biggest const was performance.. a normal test for example 30 steps, could take 20 min !   Selenium Webdriver (2009) called Selenium 2 Now to every browser will be his driver to ...
Image
A framework (based on python) that makes it easy to write small tests, yet scales to support complex functional testing for applications and libraries. Why do we need Pytest ? why selenium is not enough ? Selenium performs an action in the browser. But how we'll create a test to assert our case ? How we’ll run test suite (a bunch of test cases ) ? That's right... we need PyTest... Build our code structure (Fixtures) Create Test Suites Test Runners Provide Assertions Let's not waste time and start coding… Create Folder My_tests Create python file test_utils 1 def twice(x): 2 return x * 2 3 4 5 def thrice(x): 6 return x * 3   Code conventions: Files start (or end) with: test_ Methods start with: test_ Class starts with: Test_ Install PyTest: Install: pip install -U pytest Verify correct version: pytest --version How to tun PyTest ? Note : When you run  pytest , by default, it will look for tests in all directories and files below the current directory. We would...