Selenium Automation talk about doing what hit pit? It is how to solve?

This week our discussion topic is about Selenium Automation:

Topic : talk with Selenium to do automated ran into what pit? It is how to solve?

Topic Description : Selenium is everyone doing mainstream UI Automation framework used in the process usually write the script, you will certainly encounter a variety of pit, estimated to cost you a lot of time to find information to solve. This week we'll talk about in the course of Selenium, you run into those pits, and ultimately how to solve? Hope discussions can help students to encounter the same problem. Every share and discuss, for you are all thinking process, is a growth and improvement.

Share of results of discussion

Knowledge Planet -silent

element element can be positioned to be an error but click to switch to double-click to solve the problem of unstable positioning element, plus the use of display elements directly to wait to find, to find elements when using a while loop to find elements of direct return element objects can not find sleep 0.5 continue to find probably this way to solve the current multi-6s when up to 10 times with assertions find code that have been implemented recently made a personal cause an assertion failure ui automation little experience Gangster look correct when prompted pop div

  • Comments: After reading several times silent content sharing, but did not quite understand his train of thought, I thought it was only the beginning Click fail, so also reply "may try to use js script execution mode to click." But now read carefully read these words, some began to be puzzled.
  • If the element is resolved element can be located, but can not click on the error. There are many ways: the first can be used with more industry methods, driver.execute_script ( "$ (arguments [0]) click ().", Element), this method can be directly applied to the click event on the control. The second method can retry their packaging clicks, of course, may be combined to achieve a particular scene or logical methods (for example: detecting whether or bomb blanket block, etc.).

I recently encountered a problem

Because I'm actually not much of interface elements operate, the main operation is: Add cookie, click on the event three times, so I ran into the problem of positioning elements is relatively small. My main point is more complicated operation and simultaneously launch multiple chrome browser instances, and so mostly resource-related problems I encounter them.

  • message: unknown error: unable to discover open pages: encounter this error, according to the literal meaning, can not open a new page, and the next you can check whether enough memory to start a browser instance consumes about 220M of memory. Before me is to overlook the resources to run a script of the machine, causing met this error, the investigation for a long time.
  • Message: timeout: Timed out receiving message from renderer: the reason for this should be a lot of, if we look at the small partners Selenium logs will find that even though the script is a normal situation, there may brush this log. But I encountered this type of error, there are two main reasons:
    • Operation of the machine (hub node and a node machine or machines) cpu is played, resulting in can not handle the request, thus causing timeout.
    • Start with a docker container node, hub and node not on the same machine, time out. (Before this article I have mentioned).
  • unknown error: DevToolsActivePort file does not exist: there is no running script on the server interface, you need to configure two parameters when starting the browser: - headless (endless mode), - no-sandbox (running at the highest authority) .
  • The problem mentioned above: the element can be located, but did not click into force. I was directly employ driver.execute_script ( "$ (arguments [0]). Click ()", element) in this way, it can normally be resolved.
  • docker deployment selenium grid, on different machines, the network is, this is currently not study, you may need to use docker cluster management.
  • quit (), and close () are not used in a closed webdriver. quit is exit webdriver, and close all windows associated with it; close just close the current window. This is reflected in the Selenium Grid Obviously, if the call is a close approach will see the node has not been released.

to sum up

I have written much before the UI Automation, recent exposure to Selenium, deepest feelings, often throwing some very strange errors, then you can only check a variety of information. Really can not find the information, we can only look through the source code, often can find some ideas.

So, by this week's topic of discussion, but also suggest that you contact a new technology, you can use the side, while learning. Corresponding encounter the problem, then solve to find information, so it will be more easy to use.

That is, before Xiangshuai teacher mentioned in the curriculum Learning by doing .

Guess you like

Origin www.cnblogs.com/zhouliweiblog/p/12602906.html