lundi 9 décembre 2019

Appium IOS Test runs in debug mode but fails when running

I am testing an iOS app on a real device with Appium in Java using IntelliJ. I have a function which navigates back to another screen, it worked for me a couple days ago but, without changing anything it suddenly fails. When in debug mode it works. I set a wait which worked twice but now also fails. I can't figure out why it suddenly won't work anymore. Before it fails the app closes on the device and reopens (I have an after each that kills and relaunches the app but that shouldn't affect the test)

The Appium Log says no such element was found, but it was found beforehand? I locate the element via accessibility id and use the .click() method.

This is the Appium Log:

[info] [HTTP] <-- GET /wd/hub/session/0d0b53e8-b64f-4b10-9643-237898eedcba 200 2 ms - 593
[info] [HTTP] [info] [WD Proxy] Got an unexpected response with status 404: {"value":{"error":"no such element","message":"unable to find an element using 'accessibility id', value 'button_back'","traceback":"(\n\t0   WebDriverAgentLib                   0x0000000106277c34 FBNoSuchElementErrorResponseForRequest + 312\n\t1   WebDriverAgentLib                   0x00000001062779fc +[FBFindElementCommands handleFindElement:] + 460\n\t2   WebDriverAgentLib                   0x0000000106256d74 -[FBRoute_TargetAction mountRequest:intoResponse:] + 220\n\t3   WebDriverAgentLib                   0x00000001062441f0 __37-[FBWebServer registerRouteHandlers:]_block_invoke + 504\n\t4   RoutingHTTPServer                   0x0000000106346304 -[RoutingHTTPServer handleRoute:withRequest:response:] + 144\n\t5   RoutingHTTPServer                   0x0000000106346ac0 __72-[RoutingHTTPServer routeMethod:withPath:parameters:request:connection:]_block_invoke + 44\n\t6   libdispatch.dylib                   0x0000000219c197d4 <redacted> + 16\n\t7   libdispatch.dylib                   0x0000000219bfa6d4 <reda...
[debug] [W3C] Matched W3C error code 'no such element' to NoSuchElementError
[debug] [W3C (fec2de88)] Encountered internal error running command: NoSuchElementError: An element could not be located on the page using the given search parameters.

This is the test that fails, I even tried adding another goBack call because it's the main screen:

public void navigateTo() {
        if(!isDisplayed()) {
            try{
                WaitUtils.staticWait(5000);
                goBack();
                WaitUtils.staticWait(5000);
                goBack();
            }
            catch (Exception e){
            }
        }

        assert isDisplayed();
    }

The go back method is this:

@AndroidFindBy(accessibility = "Nach oben")
@iOSXCUITFindBy(accessibility = "button_back")
private WebElement backButton;

public void goBack() {
    backButton.click();
}

Aucun commentaire:

Enregistrer un commentaire