Automation selenium face interview questions and answers

1, how to determine whether the element selenium in existence?
- isElementPresent
 
2, selenium in hidden or display = none of the elements if you can locate?
- can not
 
3, how to ensure the success of the operation in selenium elements? That is how to ensure that I click on certain elements are clickable?
- add an element of intelligent waiting time driver.implicitly_wait (30)
- try way id, name, clas, x path, css selector in different ways to locate, if the first fails to automatically try the second
-Selenium guarantee success rate element is the element's position, of course, it's a lot of positioning methods, we will be able to have the right. However, in the implementation process automation project, the quality of automated testing is not the only guarantee of testers. Developers need to standardize the development of habits, such as page elements to add a unique name, id and so on, so that we can greatly improve the accuracy of positioning elements. Of course, if developers are not standardized, we try to use the address of a relative positioning when the positioning elements, which could reduce the impact element is positioned by the page change. As long as we have the element positioning accuracy, I can guarantee every operation in line with my expectations
 
4, how to improve execution speed selenium script?
- Selenium script execution speed is affected by many factors, such as network speed, the degree of cumbersome procedures, and page load speed, and we are in the script set waiting time, number of threads to run the script. It can not unilaterally pursue speed, to ensure the stability, regression testing is the key to stability can be achieved.

We can increase the speed from the following aspects:

First, reduce operational steps, such as through the San Sibu to open the page we want to test, then we will be able to open directly through the Web site, reducing unnecessary operations.

Second, break the page loads, if the page loaded content too much, we can look at the reasons for slow loading, if the loaded content does not affect our test, we set the timeout interrupt the page loads.

Third, set the wait time, they can sleep a fixed time, and can detect an element after an interruption wait can also improve speed.

Fourth, configure testNG implement multithreading. In the preparation of test cases, we must achieve loose coupling, and in the case of server allows, try to set up multi-threaded operations and increase execution speed.

 
5, with cases often occur during operation instability, that is to say by this time, next time there is no way through, and how to improve the stability of the use cases?
- time.sleep( )
- driver.implicitly_wait(30)
- Multi try to capture, handle exceptions
- At this point we have to analyze the causes of instability and targeted to solve the problem. Mainly in the following aspects:
First, speed problem: Sometimes pages load more slowly, elements in the program execution to be operated not showing up. This situation is more common, a speed run through the good times, run it again, the page does not open, do not pass up. In order to improve the stability, we can only run time of sacrifice, plus waiting time before an element often fails to detect, and so after the emergence of the elements to be operated again to perform the following operations.
Second, the reason Selelnium: Selenium1.0 and 2.0 there are differences, some children do sometimes run function effectively under 2.0, when the surface is invalid. If mouseover () function, as is the case, we need to avoid the use of such functions.
Third, multi-threading, when the test case between influence each other. Although multithreading when run faster, but if the coupling between the cases with no good design, will affect, if the use case A prior to the time the use case B executed, it will affect the use cases B; otherwise there is no problem. This situation, if your test automation project intends to multithreading, when tested in advance to make a test case of the relatively loose coupling, as far as possible without any relationship, because the execution order of multiple threads is uncontrolled.
 
6. What is your strategy execution automation use cases is?
- automated test case execution policy is to look at the purpose of automated testing, there are usually several strategies:
First, the automated test is used to monitor and, in this, we'll automated test set to the timing of the execution, If every five minutes or one hour once, you can create a scheduled task on jenkins.
Second, we must return to the use cases. Some children test cases, such as BVT test cases, before we change our products on line any need to return to perform. Then we put the test set to trigger execution, the bindings will jenkins our task to build test automation tasks development. When the developer in the upper part of the code simulation environment, our automated execution of test cases will be triggered.
Third, do not need to test frequently performed. Like the full amount of the test case, we do not need to return have been executed, after all, still have time to consume, and some non-main business lines do not need to constantly return. Such artificial test we perform, create a task jenkins, when the need to perform manual to build to.
 
7. What is Continuous Integration?
Continuous integration from Extreme Programming (XP) , is a kind of software practice, the software development process integration step is a long and unpredictable process. The integration process may break out a lot of problems, so the integration process requires more than small as possible and, in fact, we are constantly talking about the continuous integration of software to do the integration work. Continuous integration, the simplest form is a monitoring tool includes version control (SVN, etc.) change. When changes are found, the tool can automatically compile and test your application.
 
8, when automated testing is not required to connect to the database for data verification?
- UI Automation does not need
- interface testing will need
 
9, id, name, class, xpath, css selector of these properties, most of which you prefer, and why?
- Almost all of the elements css, xpath can be positioned to
 
10, how to locate elements on the page dynamically loaded?
- dynamic events trigger elements of the load until the emergence of dynamic elements, positioning
 
11, how to locate an element attribute dynamic?
- xpath or css positioned by sibling, parent, child
 
12, after clicking the link, selenium whether to wait for the page is automatically loaded?
- Kai basis
 
13. What webdriver client is the principle?
- [Webdriver The principle] (http://www.cnblogs.com/timsheng/archive/2012/06/12/2546957.html)

By studying selenium-webdriver source code, I found that in fact the realization of the principle webdriver not unfathomable not try to speculate. Here to webdriver  Ruby the Binding of firefox-webdriver achieved, for example, briefly explain the working principle of webdriver.

  • When the test script to start firefox, selenium-webdriver firefox browser will first start in the new thread. If the test script specifies the firefox profile, then start with the profile, otherwise it will start a new profile, and start firefox;

  • firefox -no-remote general method is started after starting selenium-webdriver firefox will bind to a specific port, firefox bound After completion of the instance as it exists webdriver a remote server;

  • The client (i.e., a test script) to create a session, the session request sent by http request restful to the remote server, remote server resolution request, and returns the corresponding operation is completed Response;

  • The client accepts response, and analyze its return value to determine whether to go to step 3 or the end of the script;

This is webdriver workflow, it seems very complicated to understand when in fact the realization of the principle of webdriver after understanding the above-mentioned problems should be relatively simple.

webdriver in accordance with the server - classic design mode client design.

end server is remote server, it can be any browser. When our script to start the browser, the browser is the remote server, its duty is to wait for the client sends a request and respond accordingly;

client end it simply is our test code, we tested the code of some of the acts, such as opening a browser, to jump to a specific url and other operations http request is sent to be tested the way the browser, which is the remote server; remote server accepts the request and perform the appropriate action, and return execution status response, the return value information and the like;

 
14, webdriver what protocols are?
-The WebDriver Wire Protocol
 
15, launch a browser which is used when the webdriver agreement?
-http
 
16. What is the page object design patterns?
-http://www.cnblogs.com/tsbc/p/4080301.html
 Similar functions where the code is the same basic interface elements to find another way, the original use xpath way, instead use the id to find, need to be changed for each use case scripts, although a few use cases do not see what the workload but repeated findElement code already makes us feel bulky code. If some positioning has changed, we have to be adjusted throughout the test code element is positioned so that it will lead to our script at a later stage, it is difficult to maintain. Therefore, we can create more robust by Page Object Model code, and reduce or eliminate duplicate test code, and thus can improve the readability of the code, reducing the effort to write the script. Page Object Model implementation is by separating the abstract test object and test scripts to achieve.
 
17. What is the page factory design pattern?
- http://relevantcodes.com/pageobjects-and-pagefactory-design-patterns-in-selenium/
 
18, how to select a value in the drop-down box = xx option?
- secondary positioning
 
19, highlighting how the elements in the positioning element (debug purposes)?
- reset element attributes, the positioning elements to add background, border
 
20, what is the assertion?
- English is the assertion assertion, assertion checking English is the assertion checking.
- assertion is a logical expression specifying a program must already exist in the state or condition of a set of program variables at some point during program execution must be met.
 
21, if you make the selection of automated testing program, you can choose which language, java, js, python or ruby?
- to use their own familiar language
 
22, page object setting mode, whether the method of positioning the page in plus assertion?
- No
 
23, page object design patterns, how to achieve the jump page?
-get, click (there may pit)
 
24, the automated test cases come from?
- Hand extracted with Example
- Automatic execution policy can refer to the use cases
 
25. What do you think the biggest flaw of automated tests?
- Unstable
-reliability
- easy to maintain
- costs and benefits
 ,
26, what is the layered test?
- [hierarchical automation] (http://www.cnblogs.com/fnng/p/3653793.html?utm_source=tuicool&utm_medium=referral)
Or your own understanding of it
 
 
27, webdriver interface test can be used to do it?
- difficult, not recommended
 

28, the difference between get and post? (Feeling may not answer)

- because the GET request does not produce any action. No action means that the HTTP GET request will not produce any results on the server. But security is not a method of action is not produced here simply refers to a method of security does not modify the information. POST requests may modify resources on the server. For example, CSDN blog, the user submits an article or a reader to submit a review is achieved through a POST request, because then submit the article or the comments submitted resources (ie, a page) different, or that resources have been modified.

Difference between the two ways of request:

1, GET request, the requested data will be appended to the URL, to? URL and transmit the divided data, a plurality of parameters & connect. URL encoding format uses ASCII encoding instead uniclde, and then transfer that is to say after all the non-ASCII characters to be encoded.

POST request: POST request will request data packet is placed in the body of the HTTP request packet. The above item = bandsaw is the actual data transmission. Therefore, GET requested data will be exposed in the address bar, and POST request does not.

2, the size of data transmission

In the HTTP specification, there is no limitation on the length and size of the transmission data of the URL. But in the actual development process, for GET, specific browsers and servers have restrictions on the length of the URL. Thus, when using the GET request, the transmission data is limited by the length of the URL.

For POST, because the URL is not traditional values, in theory, is not restricted, but in fact each server will require the submission of data to limit the size of the POST, Apache, IIS has its own configuration.

3, security

Security is higher than the GET POST

 

29, in the company has been using the test system (B / S architecture) suddenly can not visit, you need to troubleshoot and restore, tell your inspection methods

A: First, can not access the site directly enter the domain name, the website also normal before, suddenly can not access

1. The test is normal FTP can log in directly asked not log space business space business that is the question directly contact them. 

2. Does the space donated by third-level domain can access the site to open the site (domain name space are presented three), if access should not be a problem space.

3. Enter the Start menu to run the computer's cmd, in a black box that pops up, enter: ping your domain name; and press Enter to see if the IP address or IP address of your host does not match, then the DNS is incorrect is the domain names have to re-resolve domain names.

Second, the access report a 404 error (page not found). Description is the site content is normal procedural problems, take a look at the program is complete.

Third, visit the Web site appear MySQL Server Error This error is a database link, view the database and the database connection file is not an error.

Fourth, the 500 error visit the Web site appears.

1. Please log in to FTP files to see if more abnormal or missing files, indicating that the site was invaded, immediately contact the production site were carried out troubleshooting.

2. If the space program and FTP file or directory without missing just installed on the 500 error occurs, make sure the space is turned scandir () function, this view is not prohibited function.

Reference: https://www.cnblogs.com/shuiyelifang/p/5754411.html

Guess you like

Origin www.cnblogs.com/wx170119/p/12564138.html
Recommended