I have been stuck in an issue while running selenium webdriver script in android device -Portrait mode. Script is running successfully in landscape mode but when we run the same script in android device keeping device in portrait mode script is failing for few actions like clicking the link, even though object locator remains same.
Script is like below:
@Test
public void testUntitled() throws Exception {
driver.get("application uRl");
driver.findElement(By.xpath("//ul[2]/li[2]/a/div")).click();
//below line throws exception
driver.findElement(By.cssSelector("<css selector>")).click();
}
Note: First two statements execute successfully in portrait mode. However the third statement driver.findElement(By.cssSelector("<css selector>")).click();
fails (in portrait mode) and throws the below exception:
org.openqa.selenium.ElementNotVisibleException: This WebElement is not visisble and may not be clicked.
Build info: version: 'unknown', revision: 'unknown', time: 'unknown'
System info: os.name: 'Linux', os.arch: 'armv7l', os.version: '2.6.36.3', java.version: '0'
Driver info: driver.version: unknown
Command duration or timeout: 322 milliseconds
Build info: version: '2.32.0', revision: '6c40c18', time: '2013-04-09 17:22:56'
System info: os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.7.0_40'
Session ID: 1385108177533
Driver info: org.openqa.selenium.android.AndroidDriver
Capabilities [{platform=ANDROID, acceptSslCerts=true, javascriptEnabled=true, handlesAlerts=true, browserName=android, browserConnectionEnabled=true, webStorageEnabled=true, rotatable=true, locationContextEnabled=true, applicationCacheEnabled=true, webdriver.remote.sessionid=1385108177533, takesScreenshot=true, version=13}]
Please suggest how this issue can be resolved. Is there any settings to be done for running script in portrait mode?
driver.findElement(By.xpath("//ul[2]/li[2]/a/div")).click();
bring up new element<css selector>
without loading the page?This WebElement is not visisble and may not be clicked.
are you able to click on element manually in portrait mode?