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.
@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.
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.
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 ?
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] "
Test case is about adding a category and verify its added and then deleted the added category.
It works fine if I run the script in chrome browser but it fails if executed in headless chrome.
In headless script is failing as below (i am using katalon 7.3.1)
WebUI.click(findTestObject(‘Products/Add Category to a product/span_Type Category’))
println(“$NewCategory”)
WebUI.setText(findTestObject(‘Products/Add Category to a product/Search Category’), NewCategory)
WebUI.sendKeys(findTestObject(‘Products/Add Category to a product/Search Category’), Keys.chord(Keys.ENTER))
WebUI.waitForElementClickable(findTestObject(‘Products/Add Category to a product/button_Add category’), 20)
WebUI.click(findTestObject(‘Products/Add Category to a product/button_Add category’)) //WebUI.delay(5)
String AddedCategory = WebUI.getText(findTestObject(‘Products/Add Category to a product/Heading of new category’))
println(“$AddedCategory”)
if (AddedCategory == NewCategory)
{
WebUI.verifyElementPresent(findTestObject('Products/Add Category to a product/a_Remove'), 5)
WebUI.click(findTestObject('Products/Add Category to a product/a_Remove'))
WebUI.verifyAlertPresent(5)
WebUI.acceptAlert()