About the solution of SendKeys () method compile time error in eclipse

Source: Internet
Author: User

Currently in the Learning Selenium automation test, the environment is configured successfully, can normally call Google Browser access to the Web page, and get the page name. In the next step of learning, locate the element and use the element's method.

When using SendKeys () This method, always prompt an error, the code is as follows:

 Public classDemo04 { Public Static voidMain (string[] args) {System.out.println ("1111"); System.setproperty ("Webdriver.chrome.driver",                ". \\tool\\chromedriver.exe"); Webdriver WB=NewChromedriver (); Wb.manage (). Timeouts (). Implicitlywait (3, Timeunit.seconds); Wb.get ("Https://www.baidu.com"); Webelement We= Wb.findelement (By.id ("kw"))); Webelement we1= Wb.findelement (By.id ("su"));        We.sendkeys ("Ceshi");    We1.click (); }}

Using the MyEclipse compiler, you will be prompted with an error message: The method SendKeys (charsequence[]) from the type webelement refers to the missing type charsequ ence

At first, their own Baidu, the result is the answer is basically the JRE version is not correct, using 1.7 can solve the problem. The JRE was replaced by itself (currently using 1.8). Results The red line did disappear, but run an error, prompting does not support 52.0 (1.7)

The answer may be correct, but personally it is for selenium2 and not seems to be selenium3, since version 3 supports only 1.8 or more.

Baidu has no answer, so in each forum to seek help, summed up: Get three kinds of answers.

The first: The JRE is changed to 1.7.

It has been tried and is not valid for selenium3.

The second type: We.sendkeys ("Ceshi") is replaced with Wb.findelement (by.id (New string[]{"})")

Tried, the result is the same error.

Third: The compiler version is too low, does not support charsequence this type

The first two have been tried, invalid, for the third, only dead horse when live horse medical, check the local version of the MyEclipse, discovered or 2011, then a little feeling is indeed the compiler itself problem. So download the myeclipse10.7 version on the Internet, with the new edition of the compiler to run, found that it does not error.

This problem, because the compiler version is too low to cause, the whole torture me for two days. Finally solved, record, also give yourself a reminder.

About the solution of SendKeys () method compile time error in eclipse

Related Article

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.