Selenium Webdriver Tips for use (ongoing updates)

Source: Internet
Author: User
Tags xpath

1. Start end time only support control selection, do not support fill, how to do?

Such as:

Solution:

Support Javascipt to remove the reaonly attribute of the start end time and then enter it, for example:

/**
* Enter start date
*
* @param startdate
*/
public void Inputstartdate (String startdate) {
String Startjs = "document.getElementById (' StartDate '). RemoveAttribute (' readonly ');";
((Javascriptexecutor) webdriver). Executescript (Startjs);
Webdriver.typebyid ("StartDate", StartDate);
}

2. Due to the addition of new requirements, resulting in page element path changes, the original good automated test case execution failed

Solution:

When positioning elements, use id,name and so on as possible to locate, as far as possible without XPath.

If you test the system many element ID or name, etc. is not unique or even not, resulting in the need to use XPath positioning, then you can negotiate with the development students. Let them later develop new code when possible to add the element ID or name these attributes, and name the unique

Selenium Webdriver Tips for use (ongoing updates)

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.