Skip to content
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

Clicks are not working on pages #39

Open
MB1lal opened this issue Jul 21, 2022 · 2 comments
Open

Clicks are not working on pages #39

MB1lal opened this issue Jul 21, 2022 · 2 comments

Comments

@MB1lal
Copy link

MB1lal commented Jul 21, 2022

I have setup Appium project in java which uses appium-safari-driver to automate web page. I have noticed that it's not able to click on elements. For example: If I am trying to login a user it enters username and pass correctly but fails to click.

Although there is no failure that is shown in logs or something but the click never happens. I have only tested this on iOS simulator as of now.

These are the capabilities I am using:

SafariOptions capabilities = new SafariOptions()
                 .setPlatformVersion("15.5")
                 .setAutomationName("Safari")
                 .setSafariDeviceName("iPhone 13 mini")
                 .setSafariUseSimulator(true)
                 .setPlatformName("iOS");

and using page factory to click an element

 @FindBy(css = "button.radius")
    private WebElement loginButton;

 @Step
    public void clickLogin() {
        loginButton.click();
    }

Below are the Appium logs for click function:

[HTTP] --> GET /session/f7a22faf-ff5e-4136-bbdf-a693fa3370c7/context
[HTTP] {}
[SafariDriver@df56 (f7a22faf)] Driver proxy active, passing request on via HTTP proxy
[debug] [SafariDriver@df56 (f7a22faf)] Matched '/session/f7a22faf-ff5e-4136-bbdf-a693fa3370c7/context' to command name 'getCurrentContext'
[debug] [SafariDriver@df56 (f7a22faf)] Proxying [GET /session/f7a22faf-ff5e-4136-bbdf-a693fa3370c7/context] to [GET http://127.0.0.1:5100/session/6434438A-00A7-4EA5-AFB0-07C1A1E3CD3E/context] with no body
[SafariDriver@df56 (f7a22faf)] Got response with status 404: {"value":{"error":"unknown command","message":"The command 'GET /session/6434438A-00A7-4EA5-AFB0-07C1A1E3CD3E/context' was not found.","stacktrace":""}}
[debug] [W3C] Matched W3C error code 'unknown command' to UnknownCommandError
[HTTP] <-- GET /session/f7a22faf-ff5e-4136-bbdf-a693fa3370c7/context 404 6 ms - 757
[HTTP] 
[HTTP] --> POST /session/f7a22faf-ff5e-4136-bbdf-a693fa3370c7/element
[HTTP] {"using":"css selector","value":"button.radius"}
[debug] [SafariDriver@df56 (f7a22faf)] Calling AppiumDriver.findElement() with args: ["css selector","button.radius","f7a22faf-ff5e-4136-bbdf-a693fa3370c7"]
[debug] [SafariDriver@df56 (f7a22faf)] Valid locator strategies for this request: xpath, tag name, link text, partial link text, css selector, id, name
[debug] [SafariDriver@df56 (f7a22faf)] Matched '/element' to command name 'findElement'
[debug] [SafariDriver@df56 (f7a22faf)] Proxying [POST /element] to [POST http://127.0.0.1:5100/session/6434438A-00A7-4EA5-AFB0-07C1A1E3CD3E/element] with body: {"using":"css selector","value":"button.radius"}
[debug] [SafariDriver@df56 (f7a22faf)] Got response with status 200: {"value":{"element-6066-11e4-a52e-4f735466cecf":"node-7EF03BAC-80A0-4C47-BAA5-9781C4B597C8"}}
[debug] [SafariDriver@df56 (f7a22faf)] Responding to client with driver.findElement() result: {"ELEMENT":"node-7EF03BAC-80A0-4C47-BAA5-9781C4B597C8","element-6066-11e4-a52e-4f735466cecf":"node-7EF03BAC-80A0-4C47-BAA5-9781C4B597C8"}
[HTTP] <-- POST /session/f7a22faf-ff5e-4136-bbdf-a693fa3370c7/element 200 15 ms - 147
[HTTP] 
[HTTP] --> POST /session/f7a22faf-ff5e-4136-bbdf-a693fa3370c7/element/node-7EF03BAC-80A0-4C47-BAA5-9781C4B597C8/click
[HTTP] {"id":"node-7EF03BAC-80A0-4C47-BAA5-9781C4B597C8"}
[SafariDriver@df56 (f7a22faf)] Driver proxy active, passing request on via HTTP proxy
[debug] [SafariDriver@df56 (f7a22faf)] Matched '/session/f7a22faf-ff5e-4136-bbdf-a693fa3370c7/element/node-7EF03BAC-80A0-4C47-BAA5-9781C4B597C8/click' to command name 'click'
[debug] [SafariDriver@df56 (f7a22faf)] Proxying [POST /session/f7a22faf-ff5e-4136-bbdf-a693fa3370c7/element/node-7EF03BAC-80A0-4C47-BAA5-9781C4B597C8/click] to [POST http://127.0.0.1:5100/session/6434438A-00A7-4EA5-AFB0-07C1A1E3CD3E/element/node-7EF03BAC-80A0-4C47-BAA5-9781C4B597C8/click] with body: {"id":"node-7EF03BAC-80A0-4C47-BAA5-9781C4B597C8"}
[debug] [SafariDriver@df56 (f7a22faf)] Got response with status 200: {"value":null}
[HTTP] <-- POST /session/f7a22faf-ff5e-4136-bbdf-a693fa3370c7/element/node-7EF03BAC-80A0-4C47-BAA5-9781C4B597C8/click 200 34 ms - 14
[HTTP] 

@mykola-mokhnach
Copy link
Contributor

The log looks completely fine from Appium perspective. Consider reporting the issue to Apple

@DanEdens
Copy link

DanEdens commented Feb 24, 2023

I've posted my page utilities, there are some alternatives you can try to direct clicks. Safari is always tricky.

Try this one --> click_element_coordinates()
https://gist.github.com/DanEdens/ed5cb453bd97f6ee3eeb5b180a997502

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

No branches or pull requests

3 participants