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

Cannot check reference equality of functions; operands here have types 'Action<HTMLElement>' and '(Result<[HTMLElement]>) -> ()' #64

Open
phirestalker opened this issue Jun 19, 2017 · 3 comments

Comments

@phirestalker
Copy link

get the error above for the following code

` func enterContests()
{
open(URL(string: "https://prizegrab.com")!)
>>> get(by: .XPathQuery("//a[@Class='login-link']"))
>>> click(then: .wait(1.5))
>>> get(by: .id("login-with-email"))
>>> click(then: .wait(1.5))
>>> get(by: .id("login-email"))
>>> setAttribute("value", value: username.stringValue)
>>> get(by: .id("login-password"))
>>> setAttribute("value", value: pass.stringValue)
>>> get(by: .XPathQuery("//div[contains(@Class,'form-login')]/form"))
>>> submit(then: .wait(3))
>>> get(by: .contains("href", "/logout"))
=== handleResult
}

func handleResult(_ result: Result<[HTMLElement]>) {
    switch result {
    case .success(let value): errors = "no errors"
    case .error(let error): errors = error.debugDescription
    }
}

`
the line ===handleResult is the offending line

I'm not sure what I did wrong

@aaronfranco
Copy link

same problem here

        var url: URL!
        url = URL(string: "http://example.com")
        self.browser.open(then: .wait(10.0))(url)
    >>* get(by: .id("UserName"))
    >>> setAttribute("value", value: "xyz")
    >>* get(by: .id("Password"))
    >>> setAttribute("value", value: "abc")
    >>* get(by: .class("submitBtn"))
    >>> click(then: .wait(5.0))
    >>* get(by: .name("body"))
    === { (result: Result<[HTMLTableRow]>) in
            print(result)
        }

@Innoviox
Copy link

I also get this error, using the example code: has this error been fixed?

@Rballesteros
Copy link

Rballesteros commented Feb 16, 2019

This is not an error in the library it is working as intended. If you look at the error it is stating that you do not have the correct type in the result function. The last get function in your chain is returning a HTMLElement and in your result function you are putting an array of HTMLElement ( [ HTMLElement] ) if you remove the syntax for an array then the error should go away. For other people that are having similar issues, make sure to put the correct type in your result function based off what the last action in your chain is returning.

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

4 participants