question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How can get only the window elements and exclude the OpenQA.Selenium.Appium.AppiumWebElement elements from a list ?

See original GitHub issue

I’m facing a problem when I want to retrieve some elements form inside a parent element

var buttonsElements = driver.Current.FindElementByClassName("FullPrintPrescriptionsView").FindElementsByClassName("Button"); I expect to return only 4 buttons , but 48 OpenQA.Selenium.Appium.AppiumWebElement buttons are retrieved

47 elements

I want to retrieve only the buttons elements

tree

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:7

github_iconTop GitHub Comments

1reaction
shoaibmansoorcommented, Mar 31, 2021

@zahraazezo I think FindElementsByClassName("Button"); finds elements in whole page. It is not finding element inside FindElementByClassName("FullPrintPrescriptionsView").

To confirm this behaviour, you may try to find elements by driver.Current.FindElementsByXPath("//*[@ClassName='Button']"). It is also expected to return 48 elements.

I am using xpaths only in my project, and I don’t feel any slowness as compared to other selectors. I am using winappdriver 1.2-RC.

0reactions
SotaLucianocommented, Apr 22, 2021

@zahraazezo Can you expand all tree? I’m not sure, but your FullPrintPrescriptionsView has some ‘custom’ childs and FindElementByClassName returns all buttons that were found in the tree, not only for the first level… And by using xpath you are saying on which level you have to find them. Looks like you have more buttons deeper

Read more comments on GitHub >

github_iconTop Results From Across the Web

Appium Windows Application Testing only finds elements ...
When I am running my tests with the application closed to start, it can't find any of the elements I'm asserting. When I...
Read more >
How can I fetch all elements from a screen automatically
Hi, I am trying to implement a solution where it is possible to automate the elements attributes automatically, but there is no success...
Read more >
Working with select list elements
First locate a <select> element, then use it to initialize a Select object. Note that as of Selenium 4.5, you can't create a...
Read more >
WebDriver
Provided is a set of interfaces to discover and manipulate DOM elements in web documents and to control the behavior of a user...
Read more >
Appium finding an element that need to be scrolled into view
I am testing a mobile application using Appium + Selenium + Java. I have a page who contains several elements with the following...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found