Automation of web pages on mobile

Hello.
Could you give me advice in selecting tool to automated tests of web page on mobile devices.
I have some experience with testing native applications in Appium. It is really OK, but in our company there are a lot of tests in Selenium (for browser on desktop). So when it comes to to adapt them to mobile, there is questions, is Appium good approach, or should I rather use Selenium tests with workaround (set smaller size of screen)? This website is responsive so mobile devices have served just version for smaller screens.

You can use selendroid , it work same as of appium, and then using chrome browser u can get ID of element.

Thank you, good idea.

My main problem is that Appium tests may be a little different than Desktop (different timeouts, capabilities etc) so I would like to find solution to have one codebase for mobile + desktop tests. And get this idea with selenium tests with smaller screen resolution. Will results be similar?

You can use pageObject model it will give you single code base
for example, if u have same locator for a text box in desktop browser and mobile android and ios app then u can use some thing like this

@FindBy(how = How.ID, using = “username”)
@AndroidFindBy(how = How.ID, using = “username”)
@iOSFindBy(how = How.ID, using = “username”)
public WebElement login_username;

@FindBy(how = How.ID, using = “password”)
@AndroidFindBy(how = How.ID, using = “password”)
@iOSFindBy(how = How.ID, using = “password”)
public WebElement login_password;

@FindBy(how = How.NAME, using = “submit”)
@AndroidFindBy(how = How.ID, using = “submit”)
@iOSFindBy(how = How.ID, using = “submit”)
public WebElement login_submit;

Now u can use them for desktop browser, iOS browser,Android Browser

2 Likes

So you still rather recommend Appium than “fake mobile tests in Selenium with smaller browser size”. Ok… Thank you for your opinion :slight_smile:

Amit is right. Appium comes with the selenium webdriver engine (i.e. Gem in ruby) so your selenium tests should work out of the box given the correct device capabilities. The addition of the page object model is recommended for code reuse and DRY principles

1 Like

page object is of course good approach, I have this doubts because of our complicated tests in selenium (overridden standard methods as click etc. so I cant use it “as is”). Ok, thank you guys!

@czarnykwarc, I had sample project using page object model. You can refer it for your reference.

Appium+Cucumber: https://github.com/priyankshah217/AppiumCucumberTest

Appium+TestNG: https://github.com/priyankshah217/AppiumTestAutomation

Thanks,
Priyank Shah

1 Like