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

Getting error "javascript error: Cannot read properties of undefined (reading 'toLowerCase')" #155

Open
Vishnupk1993 opened this issue Nov 2, 2021 · 63 comments
Assignees
Labels
help wanted Extra attention is needed question Further information is requested

Comments

@Vishnupk1993
Copy link

If you didn't see the video how to use Healenium, please, firstly, get it know on link
https://healenium.io/

Describe the problem
A clear and concise description of what the problem you've faced with

Screenshots
If applicable, add screenshots to help explain your problem.

Please complete the following information:

  1. Versions of components (web and backend)
  2. Selenium version
  3. Platform (Java, .NET, etc)
  4. Full stacktrace with exception
  5. Logs from healenium-backend container
  6. WebDriver creation

Additional context
Add any other context about the problem here. For example, using of additional frameworks like Sizzle library, Robot Framework or JDI, etc.

@Vishnupk1993 Vishnupk1993 added the help wanted Extra attention is needed label Nov 2, 2021
@Vishnupk1993 Vishnupk1993 changed the title Getting the below error Getting error "javascript error: Cannot read properties of undefined (reading 'toLowerCase')" Nov 2, 2021
@Vishnupk1993
Copy link
Author

Getting error during execution at the below line ,
seleniumWebdriver = SelfHealingDriver.create(seleniumWebdriver);

Error
ChromeDriver was started successfully.
Exception in thread "main" org.openqa.selenium.JavascriptException: javascript error: Cannot read properties of undefined (reading 'toLowerCase')

@ElenaStepuro
Copy link
Collaborator

Hello @Vishnupk1993 !
Unfortunately, I cannot help because of lack of information.
Please, fill as much fields in issue template as possible to help you.

@ElenaStepuro ElenaStepuro added the question Further information is requested label Nov 2, 2021
@Vishnupk1993
Copy link
Author

Vishnupk1993 commented Nov 8, 2021

Please find more details below.

Problem Description
Getting error during execution at the below line ,
seleniumWebdriver = SelfHealingDriver.create(seleniumWebdriver);

1)Versions of components (web and backend) - Healenium Web version : 3.1.6 , Docker Version : Version 2.0.0.3 (31259)
2)Selenium version : - selenium-server-4.0.0
3)Platform (Java, .NET, etc) - Java
4)Logs from healenium-backend container -
image

5)WebDriver creation

WebDriverManager.chromedriver().setup();
ChromeOptions options = new ChromeOptions();
WebDriver seleniumWebdriver = new ChromeDriver(options);
seleniumWebdriver = SelfHealingDriver.create(seleniumWebdriver);

  1. Sample code :
    package healenium;
    import java.util.List;
    import java.util.concurrent.TimeUnit;
    import com.epam.healenium.SelfHealingDriver;
    import com.epam.healenium.SelfHealingDriver;
    import io.github.bonigarcia.wdm.WebDriverManager;
    import org.openqa.selenium.*;
    import org.openqa.selenium.chrome.ChromeDriver;
    import org.openqa.selenium.chrome.ChromeOptions;
    public class SampleHeal {

    public static void main(String[] args) throws InterruptedException {

     WebDriverManager.chromedriver().setup();
     ChromeOptions options = new ChromeOptions();
     WebDriver seleniumWebdriver = new ChromeDriver(options);
     seleniumWebdriver = SelfHealingDriver.create(seleniumWebdriver);
     seleniumWebdriver.manage().timeouts().implicitlyWait(4, TimeUnit.SECONDS);
     seleniumWebdriver.manage().window().maximize();
     seleniumWebdriver.manage().window().setSize(new Dimension(108,240));
     seleniumWebdriver.get("xyz.com");
     seleniumWebdriver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
     seleniumWebdriver.findElement(By.xpath("abc")).sendKeys("abc");
     seleniumWebdriver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
     seleniumWebdriver.findElement(By.xpath("abc")).sendKeys("abc");
     seleniumWebdriver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
     seleniumWebdriver.findElement(By.xpath("abc")).click();
     seleniumWebdriver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
     Thread.sleep(3000);
     seleniumWebdriver.findElement(By.xpath("abc")).click();
     seleniumWebdriver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
     Thread.sleep(2000);
     seleniumWebdriver.findElement(By.xpath("abc")).click();
     seleniumWebdriver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
     Thread.sleep(2000);
     seleniumWebdriver.findElement(By.xpath("abc")).click();
     seleniumWebdriver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
    

}
}

  1. Error screenshot :-
    image

@ElenaStepuro
Copy link
Collaborator

Hello @Vishnupk1993 !
Unfortunately, for now healenium not integrated with Selenium 4.0.0. Please, use 3.141.59 version if you can. To know about related updates you can see this issue healenium/healenium#1
Also, please, add another one container healenium/hlm-selector-imitator:1, as in example, docker-compose
In addition, do not forget to add healenium.properties file to your project

@Vishnupk1993
Copy link
Author

Hi @ElenaStepuro !
Thanks for the quick update.

Tried the same. I have changed the version to 3.141.59 version, added another container. But still we are getting the same error.
Attaching the screenshots:-
1)Docker :-
image
2) Error Screenshot:-
image
3)Selenium version:-
image

@ElenaStepuro
Copy link
Collaborator

Hello @Vishnupk1993 !
In this case, it could be because of incompatibility of chrome driver, chrome browser and selfhealingdriver. I recommend to change chrome driver version to use chrome 92 if you can

@ElenaStepuro
Copy link
Collaborator

In addition, @Vishnupk1993 , please, send full stacktrace of problem and pom.xml to check your dependencies.
I've rechecked your test example on my machine and it run without problems.

@Vishnupk1993
Copy link
Author

Hi @ElenaStepuro !
Please find the details below :-
POM XML :
Pomhealenium.txt
Logs :-
Logs_Healenium.txt

Note : - We tried the same in Salesforce community edition.
My current chrome version is 95, Please let me know how to check in a lower version through selenium.

@ElenaStepuro
Copy link
Collaborator

Hi @Vishnupk1993 !
I've rechecked your example on Chrome 95. No worries about it: you don't need to decrease browser version. But I'm worried about this warning from your log:
[1636722946.998][WARNING]: This version of ChromeDriver has not been tested with Chrome version 95.

I use chromedriver 95.0.4638.69 and your version is ChromeDriver 94.0.4606.61. Try to increase chromedriver version.
As I can see from log file, it's not healenium issue. It's somewhere in Selenium, most possible it's browser and driver integration.

@Vishnupk1993
Copy link
Author

Hi @ElenaStepuro !
We did exactly like you said but still the issue exists , Please find the below logs.
Logs_Healenium.txt

@ElenaStepuro
Copy link
Collaborator

Hi @Vishnupk1993 !
Interesting... can we have a call?

@Vishnupk1993
Copy link
Author

hi @ElenaStepuro

Greetings ! Can you please help me to understand how the elements are getting stored in docker ? and can we view the stored web elements through docker ?.

@ElenaStepuro
Copy link
Collaborator

Hello @Vishnupk1993
You can find stored web elements in database using hlm-backend container. And yes, you can view those web elements from db through docker

@Vishnupk1993
Copy link
Author

Vishnupk1993 commented Feb 17, 2022

Thanks for the update @ElenaStepuro , we tried in salesforce lightning and only the login part is getting healed. But we are not getting the report , is there any other dependency or do we need to add any extra line code to get the same ?

ppty file.txt
YML_AR.txt

the above attached are the yml and ppty file which we are using now.

@ElenaStepuro
Copy link
Collaborator

Hello @Vishnupk1993
As about docker containers, everything looks correct. Be informed that hlm-back 3.1.4 not compatible with 3.2.0+ hlm-web versions.
As about healenium properties, we don't have basePath, reportPath and screenshotPath properties.

For generating report the next points should be completed:

  • plugin dependency in pom.xml in group
  • run tests with mvn clean test command
  • test run successfully completed and healing appeared

Then you'll see link for generated report like here
image

In addition, you can see the video about plugin's setup and run: https://www.youtube.com/watch?v=hwSK5ngqOgQ&ab_channel=HealeniumCommunity

@Vishnupk1993
Copy link
Author

Hi @ElenaStepuro

We tried all the mentioned setups , we also referred few issuw #170. But the report is generating like the below

MicrosoftTeams-image

and also getting the below mentioned issues while running the script

*** Element info: {Using=xpath, value=//a[@id='forgot_password_link']}
Trying to heal...
[main] WARN com.epam.healenium.client.RestClient - Failed to make response of 'getLastHealingData' request.

@ElenaStepuro
Copy link
Collaborator

@Vishnupk1993 in previous comment forgot to say about other properties...
Please, see my comment below:

  • recovery-tries=1 - correct and you can change
  • score-cap=0.5 - correct and you can change
  • heal-enabled=true - correct and you can change
  • serverHost = localhost - correct and you can change
  • serverPort = 4567 - set the value 7878
  • imitatePort - needs to be added with the value 8000

@Vishnupk1993
Copy link
Author

@ElenaStepuro till now the same issue is getting repeated. Since it's my official code i cannot have a session with you too :( . Can you share me the latest updated yml , helaenium ppty files ?

@Vishnupk1993
Copy link
Author

i'm trying by adding break point's to check if the code is working or not. Please find the below step which i did during execution

Used intellij
I have written a login code only,

  1. so first time i run the code
  2. Then next time i will add a break point in the login xpath
  3. Once the screen is visible it will stop before clicking the login button
  4. There i manually update the login xpath and resume the execution.

Previously this was working fine for me then i updated the pom and yml i guess

@ElenaStepuro
Copy link
Collaborator

Hello @Vishnupk1993
The latest yaml file you can find here: https://github.com/healenium/healenium-example-maven/blob/master/infra/docker-compose.yaml The latest back version here is 3.2.0 and it's compatible only with web 3.2.0 and 3.2.1 versions
The latest healenium properties you can find here: https://github.com/healenium/healenium-example-maven/blob/master/src/test/resources/healenium.properties
In addition, you can see this setup tutorial: https://www.youtube.com/watch?v=Ed5HyfwZhq4

As about your steps, you don't need to update login xpath in code. It should be changed in DOM om page

@Vishnupk1993
Copy link
Author

HI @ElenaStepuro

I tried the same in my Personal Laptop and the salesforce script which i have written is working fine, but the report is not generating. If possible can we have a connect to resolve the same ?

Similarly we are also facing some issue with healing driver in some script's too.

@ElenaStepuro
Copy link
Collaborator

Hello @Vishnupk1993 , yes, if you need we can have a call. Please, send me by e-mail [email protected] available time slots for you on the next week.

@Vishnupk1993
Copy link
Author

Hi @ElenaStepuro ,
Thanks, i have shared you a mail please let me know about the time. If you are occupied with the mentioned IST please let me know your available time.

@Vishnupk1993
Copy link
Author

@ElenaStepuro We are waiting in the lobby for the clarification.

@ElenaStepuro
Copy link
Collaborator

@Vishnupk1993 I'm also in the lobby)

@Vishnupk1993
Copy link
Author

i thing you joined in the other lobby.

@Vishnupk1993
Copy link
Author

Hi @ElenaStepuro greetings, any further update on that issue ?

@ElenaStepuro
Copy link
Collaborator

Hi @Vishnupk1993 , sorry for long answer. Unfortunately, for now there are no updates from my side. I will come back to you with updates till the end of this week.
Thanks for understanding.

@raghunadh10
Copy link

Hi @ElenaStepuro ! We did exactly like you said but still the issue exists , Please find the below logs. Logs_Healenium.txt

Hi

Hi @ElenaStepuro greetings, any further update on that issue ?

Hi @ElenaStepuro ! We did exactly like you said but still the issue exists , Please find the below logs. Logs_Healenium.txt

HI @Vishnupk1993 . I have encountered a smiliar issue which is "javascript error: Cannot read properties of undefined (reading 'toLowerCase')" . i have been using the correct versions of healenium web , backend and chrome. Healenium is working on other scenarios but not on this particular scenario where it is trying to find the web element . instead of finding it , it is throwing this error. Also when the disbale healing mode is on , it is running fine . can you please check out this problem and help me .

@ElenaStepuro
Copy link
Collaborator

Hi @raghunadh10 unfortunately, for now Healenium doesn't support Js executor. We work on this issue.

@Alex-Reif
Copy link
Contributor

Hi @raghunadh10 , @Vishnupk1993 , Issue was fixed in hlm-web version 3.3.0

@Vishnupk1993
Copy link
Author

@Aliaksei-Ashukha Thanks for the resolution. Can you please share the latest yaml file ?

@Alex-Reif
Copy link
Contributor

@Vishnupk1993 , Yaml file remain the same. You need to update hlm-web dependency

@Vishnupk1993
Copy link
Author

HI @Aliaksei-Ashukha While running the script i met with this below error, can you please provide a resolution for this ?
java: warning: source release 10 requires target release 1.10

@raghunadh10
Copy link

Hi @Aliaksei-Ashukha . thanks for the update . i have one doubt regarding database we are using in healenium . can we have the ability to change the constraints on columns like (example -- adding unique constraint to locator column) . will this create any issues ? please help me on this thing . if any extra details needed, please intimate me .

@Alex-Reif
Copy link
Contributor

Hi @raghunadh10,
If we talk locator column, there is no constraint of this one.
What exactly column do you want to change ?

@raghunadh10
Copy link

hi @Aliaksei-Ashukha . In the db , locator column getting stored with duplicate values too , i want to avoid it . so i am thinking to add a unique constraint on it . so on adding it, will it cause any unreasonable behavior by healenium.

@Vishnupk1993
Copy link
Author

Hi @Aliaksei-Ashukha tried the same thing and works as expected to me. Thanks for this fix. Quickly, can we set up healenium with eclipse? Because we use our own framework that will support the eclipse rather than intellij.

@Alex-Reif
Copy link
Contributor

@raghunadh10 , Selector table also have URL, CLASS_NAME, METHOD_NAME. These values used for identify unique of locator. In case you have duplicate locator value, so URL, CLASS_NAME, METHOD_NAME should have other other value. (For example locator By.id("button"); can used on different pages.)

@Alex-Reif
Copy link
Contributor

@Vishnupk1993 , Healenium does not depend on the IDE. You can use eclipse as well.

@raghunadh10
Copy link

@Aliaksei-Ashukha , yeah right . i just saw it . thank you so much for the explanation . one last thing ashukha , so no matter how many times locator get stored or method_name got stored, healenium heals the webelement when its xpath got changed without any trouble right . the reason im asking this is for some web elements its unable to heal . its usually saying new element locator not found . may be im doing any mistake . can you please give some tips to make the best use of this healing ? thanks for your time again

@Vishnupk1993
Copy link
Author

Thanks for the update @Aliaksei-Ashukha , is there any plugin available for eclipse ? Like the Healenium plugin we used for intellij ?

@Vishnupk1993
Copy link
Author

Vishnupk1993 commented Aug 17, 2022

Hi @Aliaksei-Ashukha I tried running the script through maven and for me the browser is not getting opened im getting these exceptions, can you please help me to debug this ?
error log healenium.txt

@raghunadh10 is chrome opening for you through maven ?

@raghunadh10
Copy link

yeah @Vishnupk1993 . for me its opening fine . based on the logs, i think that mvn test command hadn't been used . Make sure you run the mvn test command to test the scripts .

@Vishnupk1993
Copy link
Author

Hi @raghunadh10 I tired the same , Mvn Clean ->MVNValidate -> MVN compile ->MVN test

@raghunadh10

This comment was marked as outdated.

@Alex-Reif
Copy link
Contributor

@raghunadh10, Yes, you're right, healenium tries to heal every time while element not found on a page.
Kindly create new issue and provide all necessary info to help us to investigate the bug.

@Alex-Reif
Copy link
Contributor

Hi @Vishnupk1993 , unfortunately no, there is no healenium plugin for Eclipse.

@Vishnupk1993
Copy link
Author

hi @raghunadh10 was it working for iframe? I saw one of your comment but now deleted. Please confirm and so that we can raise an new issue for the same.

@raghunadh10
Copy link

Hi @Vishnupk1993 . it isnt working yet vishnu . so i removed here and created new issue for help regarding that . can you also please confirm whether its working for iframe . Also vishnu , i also have trouble running mvn test , when healenium dependency is added ,mvn test command is not picking up any tests , when that dependency is removed , the tests are running fine with mvn test command. do u still face the same issue ?

@Vishnupk1993
Copy link
Author

Hi @raghunadh10 Please let me know the defect raised for the same. It's not working for me also. For me other than the frames it's working perfect

@raghunadh10
Copy link

Hi @Vishnupk1993 i have raised the defect for the mvn test command . Please check . if any inputs are also there from your side, please mention in the comments.
#205

@Vishnupk1993
Copy link
Author

Vishnupk1993 commented Sep 2, 2022

Thanks @Aliaksei-Ashukha @ElenaStepuro @raghunadh10 For all the guidance's, i have given an demonstration of healenium implemented with one of our automation script. And worked well.

But the question raised during the demo is that , is there anyway we can do the backed process with our normal sql . They are not accepting to use Postgress and Docker. So is there any idea for setting up the same through sql or any other ways ?

@raghunadh10
Copy link

raghunadh10 commented Sep 2, 2022

Hi @Vishnupk1993 . congrats on your demo. coming to your question, i am not sure about whether we can use sql or not . but we can use healenium without docker . i have implemented it in our part of project without docker only . installed every service on my local machine and tried. it worked well.

@Alex-Reif
Copy link
Contributor

Alex-Reif commented Sep 2, 2022

Hi @Vishnupk1993 , Could you contact with me directly and we can discuss about paid support and necessary adjustment .
image

@raghunadh10
Copy link

raghunadh10 commented Sep 19, 2022

Hi @Aliaksei-Ashukha @ElenaStepuro .I am from British Telecom organisation. After my demo of healenium on automation script to the team in my project .we are looking to integrate this healenium in our project completely.For this our team need info regarding the fix of salesforce error when running with healenium like ,is it a fixable issue or not ? . if you are okk to connect ,we can connect whenever it is feasible and discuss more regarding this issue and the paid support provided by you which you have mentioned earlier for vishnu.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants