Open crazyrum opened 7 years ago
is the element you clicked in the browser window or scrolled up. Make sure that it is visible or set the .screen(new Dimension(700, 1000))
is the element you clicked in the browser window or scrolled up. Make sure that it is visible or set the .screen(new Dimension(700, 1000))
When I turned off the headless mode, in the popup window I can see the page being automatically scrolled such that the button is visible and the cursor is right over it. Does it mean that it is visible then?
Yes it should be right is the scope of the window and visible to eye.
Try printing the element that you want to click, make sure you are on the correct element. Safer option would be to use xpath
Try to click manually in the popup see if it works
Try with the help of mouse click using selenium library (Actions class)
Yes it should be right is the scope of the window and visible to eye.
Try printing the element that you want to click, make sure you are on the correct element. Safer option would be to use xpath
Try to click manually in the popup see if it works
Try with the help of mouse click using selenium library (Actions class)
Thank you. I tried number 1 and 3 and it still does not work. Then I tried number 2, since I pause the thread after every click. I tried to click by hand in the popup, it does not work neither. Does it mean jBrowserDriver does not support React? Or is there anything in the settings I didn't turn on/off? I turned on (to allow) javascript for sure.
I just found out that it works on my office laptop. I am using the latest version of Eclipse Luna (on both my laptops), and the JRE I am using is 1.8. Can anyone help me explain what happened?
Java minor versions (full output from java -version
) along with an example html page to reproduce would be helpful. Thanks!
Just an update: I now use the following code:
((JavascriptExecutor) driver).executeScript( "arguments[0].click();", button); driver.pageWait();
and update my JRE to jre1.8.0_112 and it works perfectly!
I was previously on jre1.8.0_111.
I executed the following code, where the button is implemented using React. I turned off the headless mode and saw the cursor was moved onto the button but nothing happened. I also tried Actions but still does not work. It works in FireFox when I click it by hand. Any help is appreciated!
List<WebElement> listOfElements = driver.findElementsByTagName("button"); for(WebElement element : listOfElements) { List<WebElement> listOfChildren = element.findElements(By.tagName("span")); for(WebElement child : listOfChildren) { if(child.getText().equals("View more")) { element.click(); driver.pageWait(); Thread.sleep(5000); } } } driver.quit();