Check Element Present in Appium

Let’s see, How can you perform Check Element Present in Appium. In previous tutorials, You have seen, How to take Screenshot for Pass/Fail Tests in Android. Now we will see, How can we perform Assertion in Andriod Application.

 

The assertion is an Important part of Automation Testing to verify the Test Result. Using Assertion, We can make sure that target element is present on Mobile App or not. In Appium we don’t have any inbuilt function to verify the presence of element on Mobile App. So we need to find out some workaround which can help us to check if Element is present or not on the page.

 

Check Element Present in Appium

Let’s create a scenario, We have a mobile application. On a single screen, we have many buttons and texts.

We need to find that Is there any element present with the text “Click Me“. Let’s understand this using this simple example.

In above example, We have implemented the logic to verify the element with the text “Click Me” is present or not.

 

checkElementPresent() method is responsible for verifying the availability of “Click Me” text. This method will set the iselementpresent variable value true, If an element is present on the mobile app else it’s value will be false.

 

Later we are using the iselementpresent variable with assertTrue() . So Assertion will fail if iselementpresent value is false and Test will mark as fail.

 

Using this way, You can verify that particular element is present on the Mobile app page or not.

0 Comment

Leave a Reply