Chrome Headless Browser Issue

Hi Team.
The Chrome Headless browser was unable to identify the element even it is mentioned with id in the test case. While running the same test case in chrome browser it was working perfectly fine and was failing when I try to run the test case using Chrome Headless Browser.

Unable to find the element located by ‘By.xpath: //input[@id = ‘tipo_meta-display_name’]’. Please recheck the objects properties to make sure the desired element is located.

Can anyone help me with the issue.

@srianoop.d one common issue for test failing in headless mode is due to different window size compared with the plain (gui) mode.
please try to run your tests in windowed mode choosing various sizes and see if you can reproduce it, sometime elements ‘not visible’ are not rendered.

1 Like

Thanks for your response @Ibus . I tried setting up same window size in chrome browser and chrome headless browser but in normal chrome browser it was working perfectly fine but when it comes to chrome headless browser it was throwing the error that it was unable to find the element in headless browser.

Unable to find the element located by ‘By.xpath: //*[@id=“tipoForm”]/div/div[3]/div/section/div/div/section/div/div/table/tbody/tr/td[4]/div/button[1]’. Please recheck the objects properties to make sure the desired element is located.

Is there anything i was missing while running the chrome headless browser test cases!!

Unable to find the element located by ‘By.xpath: //*[@id=“tipoForm”]/div/div[3]/div/section/div/div/section/div/div/table/tbody/tr/td[4]/div/button[1]

Will the Chrome Headless browser capable of identifying elements that had Div tags in its Xpath along with its ID??

I was running a test case in the Normal chrome browser and is working fine but when it comes to Headless browser it was unable to find that element. I have also set the Window size the same as in the normal Chrome browser but still facing the error.
Is there anything to be added for the Headless browser to make the test case execution successful!!
Thanks.

@srianoop.d Try

WebUI.setViewPortSize(1360, 978)

There seems to be an issue with the xpath you are trying, It looks like Absolute xpath type but generated by Katalon Recorder ? Can you share the HTML of element giving problem ?

1 Like

Hi @manpreet.mukkar I tried setting the port size 1360,978 as you suggested but the results were same.

Unable to find the element located by ‘By.xpath: //*[@id=“tipoForm”]/div/div[2]/div/section/div/div/section/div/div/table/tbody/tr[2]/td[5]/div/button[3]’. Please recheck the objects properties to make sure the desired element is located.
i was getting the same error.

The HTML of that element is
" /html/body/tp-root/tp-layout/div/mat-sidenav-container/mat-sidenav-content/div/tp-module-loader/tp-tiporole/div[1]/form/div/div[2]/div/section/div/div/section/div/div/table/tbody/tr[2]/td[5]/div/button[3] "