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