Home > other >  The selenium phantomJS click () event is not successful
The selenium phantomJS click () event is not successful

Time:09-17

Why will not success, with firefox is no problem, but with phantomJS other everything is normal, just clik not successful, check a lot of information, didn't find a good solution, for help

CodePudding user response:

Who knows not code

CodePudding user response:

PhantomJSDriver driver=new PhantomJSDriver (desiredCapabilities);
Driver. The get (" https://www.baidu.com ");
Dimension Dimension=new Dimension (Toolkit. GetDefaultToolkit () getScreenSize ());
Int width=(int) dimension. GetWidth ();
Int height=(int) dimension. GetHeight ().

Float per=1.5 f;
Width=(int) (width * per);//1920;;
Height=(int) (height * per);//1920;
WebElement input=driver. FindElement (By id (" kw "));
Input the clear ();
//input box input
Input the sendKeys (" Dallas electric vehicles ");
//by enter the keyboard instead of clicking
Input. SendKeys (Keys. ENTER);
Input. Click ();
WebElement su=driver. FindElement (By id (" su "));
Su. Click ();
  • Related