5

I been trying to solve this issue but not sure what's the cause for this, i made a program with java and phantomjs, and in theory they both should behave the same way.

Phantomjs in both the pc and the server is the same v.2.0.

In windows(v.7) mi testing program works as expected, but in linux (debian) the program fails, with this error when it tries to click an element:

Caused by: org.openqa.selenium.NoSuchElementException: {"errorMessage":"Unable to find element with css selector

Now, i know sometimes we have to wait for few seconds for the page to load, which already do (even added a few more just to be sure) and it was tested correctly in windows.

i tried with the click function:

 element.click();

with a javascript code:

 JavascriptExecutor js = (JavascriptExecutor)driver;
    js = (JavascriptExecutor)driver;
    js.executeScript("arguments[0].click();", element)

and with actions too:

Actions action = new Actions(driver);
action.moveToElement(element).contextClick().build().perform();     
//and this code too
action.moveToElement(element).click().build().perform();

Anyone had this same or similar issue? what i else i can do? i'm stuck since yesterday and i wan't able to figure out this problem.

note: for now i have an alternate way to get page without having interaction, but still having different results from the web page when executing in different OS, for example:

where i normally i get this link: www.somesite.com/?search=xxxxx&date_in=dd/MM/yyyy&params=etc. , instead i get www.somesite.com/?search=xxxxx, the default search without any especific search parameters.

Progs
  • 1,059
  • 7
  • 27
  • 63
  • Are you using `https` in both cases? –  Feb 07 '17 at 16:15
  • 1
    @Pikachu no, they are both http – Progs Feb 07 '17 at 19:38
  • 1
    Have you tried to get more info, by using `--debug=true` Command-Line option, and [onResourceError](http://phantomjs.org/api/webpage/handler/on-resource-error.html) callback? –  Feb 08 '17 at 12:16
  • in [this case](http://stackoverflow.com/questions/41413716/casperjs-doesnt-work-as-expected-on-windows-machine/41600056#41600056), using the callbacks was very helpful to detect the problem. –  Feb 08 '17 at 19:45
  • 1
    Have you opened up a ticket with phantomjs? Have you made the smallest reproducible example so others can reproduce to help? – TJR Feb 11 '17 at 17:26

1 Answers1

4

You need to use onResourceError callback, to find out what's going wrong.
You also need to use the following Command-Line options:

--ignore-ssl-errors=true --ssl-protocol=any --debug=true

See also: this issue.

Community
  • 1
  • 1