Take the 2-minute tour ×
Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. It's 100% free, no registration required.

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: &apos;unknown&apos;, revision: &apos;unknown&apos;, time: &apos;unknown&apos;
System info: os.name: &apos;Linux&apos;, os.arch: &apos;armv7l&apos;, os.version: &apos;2.6.36.3&apos;, java.version: &apos;0&apos;
Driver info: driver.version: unknown
Command duration or timeout: 322 milliseconds
Build info: version: &apos;2.32.0&apos;, revision: &apos;6c40c18&apos;, time: &apos;2013-04-09 17:22:56&apos;
System info: os.name: &apos;Windows 7&apos;, os.arch: &apos;x86&apos;, os.version: &apos;6.1&apos;, java.version: &apos;1.7.0_40&apos;
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?

Thanks in advance.

share|improve this question
    
Does driver.findElement(By.xpath("//ul[2]/li[2]/a/div")).click(); bring up new element <css selector> without loading the page? –  Tarun Nov 26 '13 at 8:34
    
No... On performing this action driver.findElement(By.xpath("//ul[2]/li[2]/a/div")).click(); , new page loads. In the newly loaded page need to click header link. Same action is passing in landscape mode but failing in portrait mode. –  Rashmi Nov 27 '13 at 2:53
    
looking at the error This WebElement is not visisble and may not be clicked. are you able to click on element manually in portrait mode? –  Tarun Nov 27 '13 at 3:01
    
Yes , manually I am able to click and the link is visible. For running tests in Portrait mode, Is there any settings need to be done? –  Rashmi Nov 28 '13 at 3:26
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.