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

Healenium - Selfhealing is not working with bySizzle library By bySizzle.css #148

Open
swapnilshetes opened this issue Oct 2, 2021 · 7 comments
Labels
enhancement New feature or request needs automation Issue needs to be covered in test automation examples

Comments

@swapnilshetes
Copy link

swapnilshetes commented Oct 2, 2021

Hi Team, Greeting of the day,
I have implemented this feature and proper works with the docker , POM maven testng and in locater I am using findby/by to find the element e.g. " @findby(css="input#name") ". please check below details

##############################################################
//Web Elements by using Page Factory
@findby(css = "input#name")
public WebElement name;
@findby(css = "input#mobile")
public WebElement mobile;
@findby(css = "input#email")
public WebElement email;
@findby(css = "reasons")
public WebElement reasons;
@findby(css= "writeSomething")
public WebElement writeSomething;
@findby(css = "sub")
public WebElement sub;
#############################################################

Now I have updated FindBy/By with advance library using BySizzle e.g. " public By inputName() { return bySizzle.css("#name");}

##################################################################
BySizzle bySizzle = new BySizzle();

  public By inputname (){    return bySizzle.css("#name");   }
  public By inputmobile (){    return bySizzle.css("#mobile");   }
  public By inputemail (){    return bySizzle.css("#email");   }
  public By inputreasons (){    return bySizzle.css("#reasons");   }
  public By inputwriteSomething (){    return bySizzle.css("#writeSomething");   }
  public By clicksubmit (){    return bySizzle.css("#sub");   }

########################################################################

"while testing in normal mode without updated element in html it is working fine with healing is enabled and when I tried with updated element and healing is enabled. It is not working as expected. It is not doing healing not trying to healing such element ("#name") using bySizzle.css get noSuchElement error.

Could you please assist me on this. It will help us a lot to understand Selfhealing-healenium .

Thanks,
Swapnil

###############################################################################
@findby(xpath = "//div[@Class='contact-form']")
public class RegistrationPage extends BasePage {

BySizzle bySizzle = new BySizzle();

//*********Web Elements by using Page Factory*********

/*
@findby(css = "input#name")
public WebElement name;
@findby(css = "input#mobile")
public WebElement mobile;
@findby(css = "input#email")
public WebElement email;
@findby(css = "reasons")
public WebElement reasons;
@findby(css= "writeSomething")
public WebElement writeSomething;
@findby(css = "sub")
public WebElement sub;
*/

        public By inputname (){    return bySizzle.css("#name");   }
        public By inputmobile (){    return bySizzle.css("#mobile");   }
        public By inputemail (){    return bySizzle.css("#email");   }
        public By inputreasons (){    return bySizzle.css("#reasons");   }
        public By inputwriteSomething (){    return bySizzle.css("#writeSomething");   }
        public By clicksubmit (){    return bySizzle.css("#sub");   }
@swapnilshetes
Copy link
Author

Hi Team, Could you please guide us on this ?

Thanks,
Swapnil

@swapnilshetes
Copy link
Author

Hi Team, Could you please guide us on this ?

Thanks,
Swapnil

@ElenaStepuro
Copy link
Collaborator

Hello @swapnilshetes !
Unfortunately, healenium doesn't integrated with Sizzle library(

@ElenaStepuro ElenaStepuro added the enhancement New feature or request label Oct 12, 2021
@swapnilshetes
Copy link
Author

Hi @ElenaStepuro,

Thank you for your reply and I request you if possible share with me some information on Locators which are identify by JavaScript.

please check below example :

HTML ::

Enter Uname

and Locater identify by JavaScript in selenium :

String selector = ".form-group:contains('Enter Username') > input";
String query = "return $("" + selector +"").each(function(e) { return this;}).get(0)";
((WebElement)((JavascriptExecutor) driver).executeScript(query)).sendKeys("This is Java");

So is this possible , can we heal this type of locater/element through this healing library.

Thanks,
Swapnil

@ElenaStepuro
Copy link
Collaborator

Hello @swapnilshetes !
It's a known defect for js executor. I'll notify you when we include it into sprint to fix.

@swapnilshetes
Copy link
Author

swapnilshetes commented Oct 25, 2021

Hello thank you @ElenaStepuro to let us know.

As per my observation we haven't provided provision for findbyElement by JavaScript.
object invoke(Object Proxy , Method method, Object args[])
using this method , we captured only selenium findby reference and not for Selenium JavaScript reference , so its automatically execute default option. and not execute healing.

Please let us know any help because 40% (this % is approx. ) elements are identify by javascript because of this , this good idea will fail. If possible, please request you update us asap.

Thanks,
Swapnil

@ElenaStepuro ElenaStepuro added the needs automation Issue needs to be covered in test automation examples label Oct 28, 2021
@swapnilshetes
Copy link
Author

Hello @ElenaStepuro, Greetings of the day.
Do we have any updates?

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request needs automation Issue needs to be covered in test automation examples
Projects
None yet
Development

No branches or pull requests

2 participants