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

Recheck web scripts breaks in case of xpath #585

Closed
sandy170889 opened this issue May 4, 2020 · 2 comments
Closed

Recheck web scripts breaks in case of xpath #585

sandy170889 opened this issue May 4, 2020 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@sandy170889
Copy link

Describe the Bug

Recheck web scripts breaks in case of xpath.
I've tried different combinations of xpath but it does not work for any.

Note: I've used demo-app html file from official recheck web demo.
https://github.com/retest/recheck-web-example/blob/master/src/test/resources/demo-app.html

How to Reproduce?

Refer attach document for more details

Below code works fine even if there are changes in object properties
driver.findElement(By.id("username")).sendKeys("Simon");
driver.findElement(By.id("password")).sendKeys("secret");
driver.findElement(By.id("Sign in")).click();

However, below code fails for the same changes in object properties. Recheck-web does not work in case of xpath properties.
driver.findElement(By.xpath("//[@id="username"]")).sendKeys("Simon");
driver.findElement(By.xpath("/html/body/div/div/form/div[2]/input")).sendKeys("secret");
driver.findElement(By.xpath("//
[test()='sign-in']")).click();

Changes made in object properties to replicate issue:
• Remove Id for username
• Add a div before password div tags
• Change in text of “Sign in” to “Signin”

Setup

Refer attach project for details and logs

Additional Context

Refer attachment.
RecheckWebIssueRelatedToXpath.docx
RecheckSeleniumDemo.zip

@sandy170889 sandy170889 added the bug Something isn't working label May 4, 2020
@diba1013
Copy link

diba1013 commented May 4, 2020

Thanks for reporting this, I will look into the problem.

My first guess without executing the code is, that you are using the Unbreakable feature. Note that this does not work for some complex XPaths (see #391), and a corresponding warning should appear in the execution logs.

I will do a deeper analysis and report my findings here.

@diba1013 diba1013 self-assigned this May 4, 2020
@diba1013
Copy link

diba1013 commented May 4, 2020

Thanks for the detailed reproduction steps. It really helps to be able to reproduce a problem fast.

I could verify that this breaks the test due to the above mentioned missing support for XPath.

We use slf4j-api for log output which requires a binder (e.g. logback). Once you add such a binder to your project, you will see the following log output:

<dependency>
    <groupId>ch.qos.logback</groupId>
    <artifactId>logback-core</artifactId>
    <version>1.2.3</version>
    <scope>test</scope>
</dependency>

<dependency>
    <groupId>ch.qos.logback</groupId>
    <artifactId>logback-classic</artifactId>
    <version>1.2.3</version>
    <scope>test</scope>
</dependency>

Unbreakable tests are not implemented for all XPath selectors. Please report your chosen selector ('//*[@id="username"]') at https://github.com/retest/recheck-web/issues.

However, we currently see XPath selectors not as a high priority, as initial mockups show a great complexity to implement such a feature.

While XPath selectors work as long as there is no breaking change, we currently recommend to use them only in a very stable environment. Thus I would ask to use alternative selectors (e.g. id) in the meantime. We support very simple single element CSS selectors (refer to #389 and #390).

I will add your selectors to the aforementioned issue, consider this as acknowledged and therefore close this as duplicate of #391. If you have any other issues or remarks related to this issue, please consider reopening.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

No branches or pull requests

2 participants