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

More complex personal @FindBy to personal Element type #1

Open
ansonliao opened this issue Sep 23, 2016 · 0 comments
Open

More complex personal @FindBy to personal Element type #1

ansonliao opened this issue Sep 23, 2016 · 0 comments

Comments

@ansonliao
Copy link

ansonliao commented Sep 23, 2016

Hi Oraz,
Thanks for your sharing sample project on how to custom personal Element type and make @FindBy is works on custom personal Element type.

As I can't find any contact information of you in GitHub, so I am paste a issue here for asking some more complex personal Element Type.

I would like custom my Element type with a description field, to store this element's description, so that I can fetch back in page action in test report, for example in ReportNG reporter.

for example:

Public class MyWebElement extends Element {
    Private String description;
    Private WebElement webElement;

    public MyWebElement(WebElement webElement) {
        this.webElement = webElement;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getDescription() {
        return this.description;
    }
}

and passed the description value to the Element

  1. by a annotation, such as @Description below:
public class HomePageObjects {

    @FindBy(id = "sumbit")
    @Description("Home Page: [Submit] button")
    public MyWebElement submitButton;
}
  1. by a custom @findby annotation, for example:
public class HomePageObjects {

    @MyFindBy(id = "sumbit", description = "Home Page: [Submit] button")    // this is custom @FindBy
    public MyWebElement submitButton;
}

so that can add test operation information to test report, for example, ReportNG:

public void click(MyWebElement e) {
    reporter.log("Click: " + e.getDescription());
    e.click();
}

could you provide some more guide to me to implement my expectation?

Thanks.

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

1 participant