Discover action class in selenium, include the articles, news, trends, analysis and practical advice about action class in selenium on alibabacloud.com
1. Positioning of simple objects-----The core of automated testingObject positioning should be the core of automated testing, to manipulate an object, you should first identify this object. An object is like a person, he will have a variety of characteristics (attributes), such as more than we can through a person's ID number, name, or he lives in which street, floor, number to find this person. Then an object has a similar property, and we can find this object through this property.2.webdriver
Frame.html
Selenium code
public static void Testiframe (Webdriver driver)
{
Driver.get ("E:\\stashfolder\\[email protected]\\stash\\tank-moneyproject\\ Pudong Software Park Training center \ \ My Textbook \\Selenium webdriver\\ Frame\\main.html ");
At the time of the main win
Selenium Webdriver Learning--by ID, name location, input content, search, close operation;Open Google Browser, enter a different website, the search box positioning contains different elements (sometimes ID, sometimes name)Import Org.openqa.selenium.By;Import Org.openqa.selenium.WebDriver;Import org.openqa.selenium.WebElement;Import Org.openqa.selenium.chrome.ChromeDriver;Import com.thoughtworks.selenium.Wait.WaitTimedOutException;public
= Driver.find_element_by_css_selector ('#span_userinfo') +SIGN_OUT_BTN = Span_userinfo.find_element_by_link_text ('Exit') - Sign_out_btn.click () + #switches the focus to the current page pop-up warning, and gets the text of the popup box AAlert =Driver.switch_to_alert () atAlert_text =Alert.text - #Check Click to exit, do you want to pop up a message confirming exit? -Self.asserttrue (Alert_text = ='are you sure you want to quit? ') -Alert.accept ()#Click OK - - @classmethod
Web developers often need to use the JavaScript pop-up dialog box to give users some informational hints, including the following types
Reading Table of Contents
dialog box type
Test page
Code for the Selenium Action dialog box
dialog box type
1. Warning Boxes: Validation results, errors or warnings for prompting user related information
2. Hint box: Used to prompt the user to enter d
performed
The first parameter determines whether the queue is emptied. You can end the animation immediately.True to empty false does not emptyThe second parameter makes the currently executing animation complete immediately, and resets the original style of show and hide, calls the callback function, and so on
True to complete immediately
False does not complete immediately
Node Operation:Create a JQuery object$name = $ ("$ ("label name"
Or use JS to moveThe first thing to do is to locate this elementtend to use JS to locate elements, enter the following script, press ENTER, you can see the corresponding div block on the Debug page$ ("div.table-responsive")Scrolling method using ScrollLeft ()$ ("div.table-responsive"). ScrollLeft (1000)Apply to Java SeleniumTo avoid entering numbers, you can write this((Javascriptexecutor) driver). Executescript ("$ (\" Div.table-responsive\ "). ScrollLeft (Document.body.scrollWidth)" );Second,
First, the code implementationSecond, the realization principlePlease refer to the comments sectionThird, the problems encounteredStart in the process of running, always prompt null pointer exceptionReason: The @beforemehtod was written @beforeThe former belongs to the tsetng, the latter belonging to JUnitIv. SummaryMain methods: Getwindowhandle (), Dr.switchto (). window (ParentID);The method through which the caption is GetTitle (), through the content of the method is Getpagesource ()
named "Abtest" with the Name property of the cookie PrintSelf.driver.delete_cookie ("abtest") #The second kind: Delete all cookie information at onceself.driver.delete_all_cookies ()#Once you have deleted all cookies, check the cookies again to confirm that they have been completely deleted .cookies =self.driver.get_cookies ()PrintCookies#Add custom cookie informationSelf.driver.add_cookie ({"name":"Gloryroadtrain",'value':'1479697159269020'}) #View the added cookie inf
parameters. Parameters interceptor uses ognl AP to achieve this goal. To be accurate, it is the ognl. ognlruntime class, which depends on JavaReflection. For each attribute to be set, ognlruntime creates a java. Lang. reflection. Method object for it and calls its invoke method.
Of course, the type conversion is not always successful, because the user input data may not be converted to the corresponding action
the elevator.Elevator class Elevator has a member representing five states, all of which are elevatorstate interface types. The constructor of the elevator class creates the corresponding implementation class for the members representing the five states and assigns values, as follows:Publicelevator () {stopstate= New Stopstate (this);movingupstate= New Movingups
When writing a SSH2 project, in addition to using the Previously here, due to my carelessness, led to no corresponding data display on the JSP page. Originally thought that is not read from the database to the data, so I from the persistence layer, DAO layer, service Layer, action class check several times, modified multiple code, the result is found, is the last JSP did not show the data. Therefore, it is
Action class, Actiongroup class, Menumanager class introductionThe menu in SWT is the mean class, and the use of the menu class has been described in the previous section.Menu items are implemented using the Meauitem
SSH integration exception: action not found.
Check Procedure:
1. Check whether the value of the class Attribute corresponding to the action in your struts. xml file can be found in the Spring configuration file.2. If you are sure that your configuration is correct, the package is missing when you import the package. At this time, check whether there are the fol
Exclude a factor, the first preferred to think of regular expression, helpless toss half a day without success, feeling is selenium on the elements of Attrs press re search in action, $ on the end of the string detection is useless. The beautifulsoup can be detected using the class of the output element of the element[' class
In the daily page source code, we based on the element ID to locate is the most foolproof, the ID in a single page is not duplicated. But in practice, many front-end developers do not write ID attributes for each element. A typical HTML code is as follows:1 Divclass= "Sui-tips s-isindex-wrap sui-tips-exceedtipnews"style= "display:none; width:auto;">Divclass= "Sui-tips-arrow"style= "left:15px;">em>em>Div>Divclass= "Sui-tips-body">Call me too many times today,BR>Let's have a little more of it tomo
Selenium webdriver Automated test Design (Webdriver Automation architecture design, definition interface, log processing, Java robot class applications)For you to share a set of courses, interested can add me 2748165793For more free information, you can view Http://blog.sina.com.cn/sonyandnokiaThe happy paradise of the yard farmCourse Outline1th Chapter:Introduction to the course overviewSelenium Introducti
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.