Skip to content

fix button_exact, text_exact for uiautomator2 driver #543

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed

fix button_exact, text_exact for uiautomator2 driver #543

wants to merge 1 commit into from

Conversation

rajdeepv
Copy link

currently, text_exact method throws Selenium::WebDriver::Error::NoSuchElementError if used with appium-uiautomator2-server. This is because findByUiAutomator uses only the first selector (Which we send as description and not text)

public UiSelector findByUiAutomator(String expression) throws UiSelectorSyntaxException {
        List<UiSelector> parsedSelectors = null;
        UiAutomatorParser uiAutomatorParser = new UiAutomatorParser();
        final List<UiSelector> selectors = new ArrayList<UiSelector>();
        try {
            parsedSelectors = uiAutomatorParser.parse(expression);
        } catch (final UiSelectorSyntaxException e) {
            throw new UiSelectorSyntaxException(
                    "Could not parse UiSelector argument: " + e.getMessage());
        }

        for (final UiSelector selector : parsedSelectors) {
            selectors.add(selector);
        }
        return selectors.get(0);
    }

@jsf-clabot
Copy link

jsf-clabot commented Apr 15, 2017

CLA assistant check
All committers have signed the CLA.

@rajdeepv rajdeepv changed the title fix text_exact for uiautomator2 driver fix button_exact, text_exact for uiautomator2 driver Apr 15, 2017
@KazuCocoa KazuCocoa mentioned this pull request Apr 16, 2017
6 tasks
@KazuCocoa
Copy link
Member

KazuCocoa commented Apr 16, 2017

Thanks!
ruby_lib has similar methods in other places. So, we should fix them as same.

Could you try #544 branch?
I use XPath strategy instead of uiautomator to fix this issue. So, your tests may work with #544, I think.

@rajdeepv
Copy link
Author

XPath strategy also works

@KazuCocoa
Copy link
Member

Thanks! @rajdeepv

I'll check #544 more with other OS versions and release ruby_lib as 9.4.0 soon.
So, I close this PR.

@KazuCocoa KazuCocoa closed this Apr 16, 2017
@rajdeepv
Copy link
Author

Thanks @KazuCocoa

@KazuCocoa
Copy link
Member

Just published as v9.4.0 @rajdeepv

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants