Java phantom JS behaves differently in windows and Linux
I've been trying to solve this problem, but I don't know why,
Phantomjs in PC and server is the same v.2 0
In windows (v.7), the MI test program works as expected, but in Linux (Debian), the program fails. This error occurs when it tries to click an element:
Caused by: org.openqa.selenium.NoSuchElementException: {"errorMessage":"Unable to find element with css selector
Now, I know that sometimes we have to wait a few seconds to load the page, which has been done (and even added to make sure) and it has been tested correctly in windows
I tried the click function:
element.click();
Use JavaScript code:
JavascriptExecutor js = (JavascriptExecutor)driver; js = (JavascriptExecutor)driver; js.executeScript("arguments[0].click();",element)
And take action:
Actions action = new Actions(driver); action.movetoElement(element).contextClick().build().perform(); //and this code too action.movetoElement(element).click().build().perform();
Does anyone have the same or similar problem? What else can I do? I've been in trouble since yesterday. I can't figure it out
Note: now I have another way to get pages without interaction, but when executed in different operating systems, I will still get different results from web pages, for example:
Usually I get this link: www.somesite.com com/? search = xxxxx& date_ In = DD / mm / yyyy & params = etc. instead, I get www.somesite.com com/? Search = xxxxx, the default search does not have any specific search parameters
Solution
You need to use the onresourceerror callback to find out what the problem is
--ignore-ssl-errors=true --ssl-protocol=any --debug=true
See also: this issue