So this has me quite mixed up.
We have a testing framework using Selenium, Specflow and C#. Currently running Selenium 3.13.1 (Just upgraded yesterday to see if the older version (3.11.2) was the issue)
The issue (only when Emulating a mobile device in Chrome):
When running tests locally all is well, buttons are clicked and the test passes. When running tests remotely on the Jenkins slaves it works some of the times .i.e. sometimes I get a click and sometimes I do not. When the Jobs are run as per schedule some of the tests fail consistently (these being tests that run perfectly well when run locally).
I have tried adding a Sleep of 5 seconds, however this did not help.
One thing that did work is changing Click() to SendKeys(Keys.Enter).
Executing javascript to click the button works well too however I do not wish to change from click for 2 reasons. 1. This is the closest action which simulates user input and 2. This works well locally.
Chrome versions on the Jenkins slaves are in line with my local version (67.0.3396.99) and Chrome driver is also inline (2.40.565498).
Chrome driver has been updated yesterday since I have tried with version 2.38 and 2.39 but to no avail.
Has anyone come across this issue and found a solution?
P.S. When running tests not in mobile emulation I have no issues with clicks both locally or on Jenkins.
For anyone who has this issue, this is the current relevant answer at this point in time.
This was not an issue with the framework we are using but an issue with chromium and chrome driver.
The issue/bug link can be found here (this is the known issue quoted below).
Also if you check the documentation for chrome driver mobile emulation, it is mentioned on the first line as follows
Note that Mobile Emulation is subject to this known issue.
This answer does not help solve the issue per se but gives the reason why it is happening. The "best" workaround I have found is using JS to click and so on. In our case we stopped using mobile emulation for now since clicking with JS does not really emulate a real click. As new versions of Chrome and ChromeDriver are realeased I will keep updating until there is a fix for it.
Hopefully you will waste less time than I have searching around for an answer :)