Ask a Question

Mobile testing

SOLVED
ḥari
Contributor

Mobile testing

Hi team,

1) I am doing mobile web testing using emulators. It is opening as a "smartbear test extension" started debugging this browser. Here i need to set a resolution based on the mobile we are selecting. So, i need to set a resolution over there.

>>refer the below code,

function main(){

VirtualBrowsers.Item("iPad").Run();

var mblPage=VirtualBrowsers.CurrentBrowser.Navigate("https://www.smartbear.com/");

var element=mblPage.FindElement("xpath");

element.click();

}

>>Here need to set resolution over there as width (768) and height (1024) 

 

2) I tried to click over an element in that page but it throws error as TypeError: cannot read property "FindElement" of undefined

Could any one helpme regarding this issue??

14 REPLIES 14
rraghvani
Trusted Contributor

I have verified this option, but i didn't noticed that width and height. Thank you

 

How to accessing web objects in virtual browsers???

rraghvani
Trusted Contributor

Like you normally do when accessing a browser.

Did you refer this code

function main(){

VirtualBrowsers.Item("iPad").Run();

var mblPage=VirtualBrowsers.CurrentBrowser.Navigate("https://www.smartbear.com/");

var element=mblPage.FindElement("xpath");

element.click();

}

 

>>error as "TypeError cannot read property "FindElement " of undefined

rraghvani
Trusted Contributor

Navigate Method doesn't return anything, and you are calling FindElement. You need to get the Page object - refer to TC documents, there's plenty of examples.

var page=VirtualBrowsers.Item("iPad").Run("https://www.smartbear.com/");

here also page object return empty only

Can you pls help me here somewhere i am missing out the logic ???

rraghvani
Trusted Contributor

Run Method returns a Process object.

 

If you do a Google search for "testcomplete page object", the top result will point to https://support.smartbear.com/testcomplete/docs/reference/test-objects/controls/web/general/page/ind...

 

 

@rraghvani i can understand what you are saying but

Here I am using page object for virtualBrowser but it's throwing error as cannot read property "FindElement" of undefined

 

>>Navigate method doesn't return anything means now am using Run method. Now also am getting same error.

Refer the sample code below,

let page=VirtualBrowsers.Item("Apple iPad").Run("https://www.google.com/");

var element=page.FindElement("XPath");

element.click();

 If I use Run method also page object doesn't return any object!! 

Here I need to search like findelements method for mobile object

Literally confused her about the (locationstrategy and selectorvalue) 

Page. Findelement("xpath", "//*[@class='mblvalu']) 

If am wrong correct me 

 

rraghvani
Trusted Contributor

In your code that you have written

 

var mblPage=VirtualBrowsers.CurrentBrowser.Navigate("https://www.smartbear.com/");

 

the Navigate Method returns none, and not a Page object.

 

and,

 

var page=VirtualBrowsers.Item("iPad").Run("https://www.smartbear.com/");

 

the Run Method returns a Process object if found, and not a Page object.

 

Make sure you fully understand the above methods and their return objects. In my previous response, did you see the code example in Page Object? It's vital you learn the basics, knowing how to select an object on a page, before jumping ahead and wanting to use VirtualBrowser

cancel
Showing results for 
Search instead for 
Did you mean: