ericmckean / chromedriver

Automatically exported from code.google.com/p/chromedriver
0 stars 0 forks source link

touch events sometimes don't work in mobile emulation mode #945

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
When running the following, the page does not respond to the call to click().

from selenium import webdriver
chrome_options = webdriver.ChromeOptions()
chrome_options.add_experimental_option('mobileEmulation', { 'deviceName': 
'Google Nexus 5' })
driver = webdriver.Chrome(chrome_options=chrome_options)
driver.get('http://mhub.ladbrokes.com/gaming/casino')
login = driver.find_element_by_class_name('btnSignIn')
login.click()

However it does seem to work on http://news.google.com...

OS: Ubuntu Trusty
Chrome: 38.0.2125.104
Selenium: git 29c4b586e20669a312c0448a1ebcd2d6e1f6a01e (should be same as 
2.43.0)
ChromeDriver: 2.11.299256

Original issue reported on code.google.com by samu...@chromium.org on 20 Oct 2014 at 10:49

GoogleCodeExporter commented 9 years ago
Fixed in https://codereview.chromium.org/663343003/ and will be in 2.12

Original comment by samu...@chromium.org on 24 Oct 2014 at 5:49

GoogleCodeExporter commented 9 years ago

Original comment by samu...@chromium.org on 27 Oct 2014 at 8:47

GoogleCodeExporter commented 9 years ago
Hi Samu, i'm using latest chromedriver with c#. I'm not able to perform any 
actions in the emulation enabled window via webdriver actions. But i'm able to 
click the buttons manually.
Checked with my development team and they suggested me to use TouchActions.
Tried with TouchActions too, but not able to implement TouchActions in my code.
Below is the piece of code used for TouchActions click:

IHasTouchScreen touchScreenDriver = WebDriverObj as IHasTouchScreen;  --**  
(This is returning null)
TouchActions touch = new TouchActions(WebDriverObj).SingleTap(login);

Can you please help me out in this.

Thanks.

Original comment by hemaacr...@gmail.com on 17 Feb 2015 at 7:25

GoogleCodeExporter commented 9 years ago
Hi,

Below is the piece of code used for emulation and it works fine.

Dictionary<String, String> mobileEmulation = new Dictionary<String, String>();
mobileEmulation.Add("deviceName", FrameGlobals.DeviceName);
ChromeOptions chromeCapabilities = new ChromeOptions();
chromeCapabilities.AddAdditionalCapability("mobileEmulation", mobileEmulation);
WebDriverObj = new ChromeDriver(chromeCapabilities);                    
WebDriverObj.Navigate().GoToUrl("http://mhub.ladbrokes.com/gaming/casino");

For TouchActions this is the code,
IHasTouchScreen touchScreenDriver = WebDriverObj as IHasTouchScreen;
IWrapsDriver wrapper = WebDriverObj as IWrapsDriver;
touchScreenDriver = wrapper.WrappedDriver as IHasTouchScreen;
wrapper = wrapper.WrappedDriver as IWrapsDriver;
this.touchScreen = touchScreenDriver.TouchScreen;
TouchActions touch = new 
TouchActions(WebDriverObj).SingleTap(WebDriverObj.FindElement(By.XPath(login)));

It is throwing error. Can someone look into this.

Thanks.

Original comment by hemaacr...@gmail.com on 17 Feb 2015 at 9:49

GoogleCodeExporter commented 9 years ago

Original comment by samu...@chromium.org on 21 Feb 2015 at 12:25

GoogleCodeExporter commented 9 years ago
Can someone please help me?

Original comment by hemaacr...@gmail.com on 23 Feb 2015 at 11:04

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I actually have same problem.

some element can be clicked with element.Click() method.
however, some are not.

OS: Windows 7 SP1 x64
Chrome:  40.0.2214.115 m
Selenium: 2.44.0.0 C#
ChromeDriver: 2.14

Original comment by work.and...@gmail.com on 24 Feb 2015 at 2:58