Selenium automation

Hey, little friends the weekend not as big a pig as in overtime, to share a super interesting things today Selenium automated testing / transfer tool.

Selenium is like real users do the same, Selenium tests can Internet Explorer on Windows, Linux and Macintosh, Chrome and Firefox run. Other testing tools can not cover so many platforms. And our Selenium tests run in a browser, there are many other benefits, we are behind and then slowly introduced.

9028759-a58db857283f20e9.png

Here large pigs describes how to use a language of Kazakhstan, after all, so many languages ​​no less than primary brain usage.

Then again, that Selenium How many languages support it? Big pig obtained from the official website of information is: the Java , Scala , C # , Ruby , Python , JS (the Node)

So it seems, still with a lot of, if not satisfied we can also use Selenium IDE features that operate only on the browser, because a lot of small partners to test hand-written code there is still resist.

Here the big pig using Selenium IDE to demo it for you, it is a browser plug-in, Chrome downloads to pull / Firefox download to pull .

Show you how simple it is to open the books of the big pig, and open an article commenting.

Relatively simple steps that we usually open the paper and see a large pig comment on it, after the recording stops, generates the following script editing interface:

9028759-6f9f167c799756e1.png

Look, that's the big pig open an article all operations comment.

  1. Open the Chrome browser https://www.jianshu.com/u/3b4ddfabfd77 large pig blog home page.

  2. Set window size, use the default configuration.

  3. Click on a name for the link analysis of actual combat (retained computing) Spark + Hbase one hundred million flow articles.

  4. Focusing open windows, automatically.

5 to 6 large pig should slide into the bottom of the page to comment.

  1. Click the input box gets the focus.

  2. Enter the text Selenium Dafa is good .

  3. Click the Send button to comment.

It is not the whole process is very simple? The recorded script and change it, and another one is a large pig operation article visit.

9028759-6f9f167c799756e1.png

Operation behavior: that is, all the gestures, including click, double click, mouse, keyword, and so on.

Switch: whether to prohibit the operation.

Configuration window: Click the link opens a new window configuration.

Search element: test whether elements in the interface, if the interface displays the following focus

9028759-f1d175dc16abec43.png

Re-select: If you think the wrong element, and can also choose to re-operate, because sometimes the page will change with the upgrade thing.

Playback: We have modified is to play a good script and automate operations.

9028759-31338a3abaf57b4c.png

As already finished using Selenium IDE, we can also, if need complex programming operations recorded script.

Big Pig scala use the following language to demonstrate:

Download chrome driver package, to correspond to their own version of Chrome: Chrome drivers list

Add gradle dependencies


9028759-0b878701f69fb1a8.png

Operation code

9028759-fd11d450883f367c.png

Languages ​​are interoperable, I believe we can copy or imitate

Programming advantage is that you can use complex logic for processing.

9028759-4cb4da98d4d14636.png

You think clearly, from this moment.

9028759-7586fee586f2075b.png
9028759-5619fe0d9edd7a1b.png

Guess you like

Origin blog.csdn.net/weixin_34283445/article/details/90840012