Not able to click on div/ button on Sencha app using Selenium iphone driver

73 views
Skip to first unread message

Sumit Tiwari

unread,
Feb 27, 2014, 8:28:29 AM2/27/14
to seleniu...@googlegroups.com
Hey,
I have developed a mobile web application using Sencha Touch2.x.
I am trying to do the automation testing of that app using the Selenium2 iphone driver because i want to test that on iPhone Simulator.

Sencha app code:

// Part of signIn page:

{code}
// To create a signIn button

var signinButton = {
         xtype : 'button',
         text : "Sign In",
         ui : 'yellow',
         cls : 'signin-btn',
         name : 'signinButton',
         id : 'signinButton',
         handler : this.onSignInSubmitTap,
         scope : this
      };

// Event handler
onSignInSubmitTap : function() {
      this.fireEvent("onSignInSubmitTap", this);
},


// To handle the event controll
control : {
         signInForm : {
            onSignInSubmitTap : "signInSubmit" // This signInSubmit method is responsible to get the field and values submitted from form.
         }
      }


{code}

This code works fine in Sencha mobile web application.

To automate the test for this signin page, I have create a code in java for selenium
Selenium java code:
{code}

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.iphone.*;

public class Automation {
	public static void main(String[] args) throws Exception {
		
		@SuppressWarnings("deprecation")
		WebDriver driver = new IPhoneDriver();
		
		driver.get("http://xyz.com");
		driver.findElement(By.name("phone")).sendKeys("5551112002");
		driver.findElement(By.name("password")).sendKeys("madam1");
		driver.findElement(By.id("signinButton")).click();
				
	}
}

{code}

The click on button is not working.

I also tried following things to simulate the click:
{code}

WebElement link = driver.findElement(By.className("signin-btn")); 
Actions builder = new Actions(driver); 
builder.moveToElement(link).click().perform();

OR 
driver.findElement(By.xpath("//div[@class='signin-btn']")).click();

OR
driver.findElement(By.id("signinButton")).click();

WebElement element = driver.findElement(By.id("signinButton"));
JavascriptExecutor executor = (JavascriptExecutor)driver;
executor.executeScript("arguments[0].click();", element);

OR

driver.findElement(By.cssSelector("div.signin-btn")).click();

{code}

Also, I tried to create a custom event for click or (touchStart, touchMove, touchEnd), (mousedown, mouseup) and dispatch that. But none of the above help me to click on that button which is created by a div and CSS3

Please help me in this. 

Thanks in advance.

Sumit Tiwari

unread,
Mar 5, 2014, 4:16:25 AM3/5/14
to seleniu...@googlegroups.com
Is someone have any idea on it.
Reply all
Reply to author
Forward
0 new messages