0

I'm trying to automate tests for a mobile application in C# using Selenium with Appium. This application was made using Flutter and there is a section where I have to select the purchase date for an item (picture of the element with its class and attributes are shown below): Purchase Date Element

I tried clicking on the element using this:

IWebElement calendrierBouton = Outil.Driver.FindElementsByClassName("android.view.View")[14];
calendrierBouton.Click(); 

However, the code above doesn't click on the element. I tried using IJavaScriptExecutor and this doesn't work either. The code for this is seen here:

((IJavaScriptExecutor)Outil.Driver).ExecuteScript("arguments[0].click();", calendrierBouton);

When I test the mobile application manually, I'm able to click on this element, and it brings up a calendar to select the purchase date: Manually Clicking on the Purchase Date Element

I'm using the BrowserStack platform to run the test. I tried using the SendKeys() method to type the date within the purchase date element, but this doesn't work either. Any advice on how I can click on the purchase date element to open the calendar?

5
  • How do you know it's element[14]? Commented Apr 15, 2024 at 16:10
  • @JeffC I used DevTools and it showed that it's element[14]. Commented Apr 15, 2024 at 18:42
  • Its a bad way to find the element, and in your screenshot it says it element[3] Commented Apr 19, 2024 at 21:25
  • @mosaad Is the best way to find an element with XPath? I ended up using the XPath of the element. Commented Apr 27, 2024 at 23:49
  • @EvangelineDrink XPATH is fine but using xpath to find the 14th element is not the best way, Commented Apr 29, 2024 at 16:58

1 Answer 1

0

You can try using different appium versions to see if there is any improvement: https://www.browserstack.com/app-automate/capabilities

You can also check the elements if they are searchable in Appium Inspector.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks! How am I able to access Appium Inspector? When I use BrowserStack's App Live, I only have access to DevTools, but not Appium Inspector (there is no button to access it).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.