[PYTHON] Make testing with Selenium more accessible

This article is the 19th day article of selenium_and_appium Advent Calendar 2016.

controll-iloveimg-compressed.gif

Introduction

This is the first post! This is TEISHISEI! Write without fear of misunderstandings!

My company has a lot of different services, and there are testers for that. Forever, check for broken links, lick all pages to take screenshots, and marathon until a probable event occurs. Selenium automates that kind of testing. The more you dig up, the more projects you need to automate. Now I need to write code for Eternity and Selenium. I thought it also needed automation. I sought to find a way for everyone to build tests, even if they weren't programmers. Below is a summary of the required requirements.

--First, the user is not a programmer, with as little prerequisite knowledge as possible --Being able to record browser operations --Editing should be GUI ――I want to write if and loop processing --Cross browser

We've explored Selenium IDE, Selenium Builder, imacros and a variety of other solutions. Each had its advantages and disadvantages, and one had a wall. In the case of games, loops are required for marathons, stamina is restored, if is required due to accumulated requests, and finally it is necessary to teach how to use if statements. If it is a step that does not correspond to the output, an error will occur, and I am tired of having steps to cut If it is not cross-browser, or if it is fine, you can not delete all steps at once, or you need to click three times to press the delete button. Do you want to send a request to an external API? Requests have increased.

So I decided to make it. Its name is Selenium Code Builder Yes, we redeveloped the wheels. Far from redevelopment, there is no way to do it within the extension. As the name implies, it builds ** Code **. Write test code and run it in Ruby or Python. (Windows is easier to build in python environment, so it can be output in python as well.)

Of course, I don't think it's better than other tools, but it has the advantage of being able to quickly catch up and update requests. I am satisfied with the usability and the ability to incorporate if and loop processing. This time, it will be open source, so I hope that more people will come into contact with Selenium, so I will share it.

Overview

Selenium Code Builder GitHub

It is a Chrome extension that assembles and outputs browser test code using Selenium with GUI. The output test code is compatible with the following languages and browsers.

language

Browser that can be executed

Installation method

I'm sorry, it's not a public extension yet, so you'll have to build it manually.

$ npm install -g bower gulp
$ npm install
$ bower install
$ gulp build

--Open Chrome --Menu

What can i do?

Record browser operations

You can record the operation of the browser. The operations that can be recorded are as follows.

--Go URL

Save and load files (json), convert to Ruby or Python

You can save and load files (json) and convert to Ruby or Python. When converting, you can choose Chrome, firefox, Android version and browser.

Steps that can be defined

URL related

--Go to the specified page --Move to the specified page with basic authentication --Browser back, forward, reload --Get the current url

DOM element related

By actually clicking the element, you get the css selector and judge the element.

--Click the element --Double click on the element --Clear input element --Input to input element --key event transmission --Enter in the checkbox

Browser related

--Run javascript --Taking screenshots --Specified px scroll --Resize browser window --Get json data while displaying --Press OK on window.alert --Press Cancel in window.alert --Enter in window.prompt --Get the characters in window.alert

Ruby and Python related

--Code execution --Sleep

Test related

--Value validation --Regular expression validation of values --Verify that the current page has the specified text

Other functions

--Search tool to find out how many specified selectors are on the page --Mechanism to divide into multiple files and run one web driver --Take the whole screenshot with chromedriver

at the end

The user tried to make the threshold as low as possible because he was not a programmer, but there were still some that could not be wiped. I'm glad that I was able to make it known that there is an option called Selenium, there is a usage that is not in the frame of testing, and I was able to reduce some man-hours. I hope E2E will continue to develop in the future.

The next article is also me. Sorry for the boring article, but please keep in touch!

Recommended Posts

Make testing with Selenium more accessible
Scraping with selenium
Scraping with selenium ~ 2 ~
Scraping with Selenium
Beginning with Selenium
Successful scraping with Selenium
Make Lambda Layers with Lambda
Automate UI testing with Selenium API | Crawling websites with python
Make more visible performance indicators with PyTorch and scikit-learn
Make Yubaba with Discord.py
ScreenShot with Selenium (Python)
Testing Elasticsearch with python-tcptest
Scraping with Selenium [Python]
Make slides with iPython
Scraping with selenium in Python
Scraping with Selenium + Python Part 1
Make sci-fi-like buttons with Kivy
Automate python testing with CircleCI
Python: Working with Firefox with selenium
Scraping with Selenium in Python
Make Jupyter Lab accessible remotely
Easy to make with syntax
Make Puyo Puyo AI with Python
Let's make dice with tkinter
Make a fortune with Python
Pre-try local testing with Travis
Memories of fighting with Selenium
Scraping with Selenium + Python Part 2
Try Selenium Grid with Docker
Testing HTTP requests with ESP-WROOM-32
I-town page scraping with selenium
Make a fire with kdeplot
Make Slack chatbot with Errbot
I tried to make a periodical process with Selenium and Python