5/30/2023 0 Comments Canberra 1270 desktop inspectorDid you observe that Desktop version provides many additional properties which are not provided by mobile browser? Also there are some properties which are identified differently. This should look like the image as displayed below –Ĥ. Inspect Google Search box to view its properties. Now click on F12 so that Developer tools window is displayedģ. Open Chrome browser in Desktop and then open Google HomepageĢ. Follow the steps given below to inspect the search box –ġ. This is the standard Selenium approach where you identify the properties of an object on Desktop browser. Identify Google Search box using Desktop browser based properties Let’s understand this with the help of below example. In a nutshell, his means that you can identify a control using both mobile and desktop browser based properties. But since Appium is built on top of Selenium, this allows you to use all those Desktop based properties as well which are not in mobile version. This means that Desktop version of this control shows some additional properties which are not displayed when you identify the same control using mobile browser. You would have observed that the properties shown in Appium Desktop Inspector are bit different from the properties that you see in the desktop browser version. Note 3: Since the content-desc property is blank, hence we cannot use it in this case.Īs of now, we have identified the Google search box using the properties that are exposed by Android via Appium Desktop Inspector. So you can use any valid xpath combination here. Note 2: The process of using xPath is same as that in Selenium. For now, if you try using the code marked as NOT working, then you will see NoSuchElementException when you run the code. Why this code won’t work? You will see that in the next section. In the above lines of code, some statements have been marked as – code will NOT work. Second will = 'lst-ib']")).sendKeys("Google") Find element using Xpath - First line of code will NOT work. Find element by Class Name - The below line of code will NOT workĭriver.findElement(By.className("")).sendKeys("Google") The code for this is given below.ĭriver.findElement(By.id("lst-ib")).sendKeys("Google") Using the above image as reference, let us have a look at the different ways using which Google search box can be identified. If you can’t identify the elements using any of these locators or identifiers, then you would most probably have to go with XPath. Important Note: Please note that in the above image we have only added the properties which are most commonly used to identify the mobile element. This is just a easy way to figure out as to which find element method is used with which locator. Different ways to identify Google Search boxįirst of all, have a look at the below image which shows the mapping of different locators and find element methods. Let us now have a look at the different properties that you can use to identify this control. It is from this section that you have to choose the property using which you will identify the element. This section shows all the properties of the control which you have selected. The last section in Appium Desktop Inspector is the Selected Element section. Identify Google Search box in mobile browser using Appium Desktop Inspectorįollow the steps given below to identify the properties of Google search box –Ĥ. We have already covered points 1 and 2 in our previous article on how to identify mobile browser elements with Appium – Part 1.
0 Comments
Leave a Reply. |