Identifying images at a given position

Hi Experts
I m a novice here to automation, and going to do my first script
Can anyone kindly check the attached screenshot [of a web-page] and let me know the foll. →

  1. How do I identify an image? and also verify that it is in top-left of the web page [in this case] at a specific position?
  2. On the right-side, you should see three text-boxes and inside these 3 textboxes there are some text in light grey color. How do I identify these 3 texts which are in light-grey color?

Kindly let me know. Many Thanks

1 Like

Hi there,

Thank you very much for your topic. Please note that it may take a little while before a member of our community or from Katalon team responds to you.

Thanks!

If you right click on the image and choose “Inspect” from the pop-up, the browser should display the page’s HTML. Do this a second time and the object’s specific HTML will show.

If the “Inspect” does not show in the pop-up, use the F12 key and then click on “Open DevOps”. Use the first icon at the top left (of the DevOps area) to click on the object and the HTML will display.

If the image is associated with an <img> tag, perhaps you can use the whole pathway to state which image it was. As for position, there are “get left” and “get top” within TestObject statements, as well as X and Y for WebElements.

As to the positioning, perhaps you can compare the objects position is either greater than, or less than, or equal?

For your textboxes, select each of them in order and right click and select “Inspect”. Is there an attribute, like <placeHolder> or something, that has the wording you want?

"first textbox"
WebUI.verifyElementAttributeValue(findTestObject('...'), "placeHolder", "Company", 10)
"second textbox"
WebUI.verifyElementAttributeValue(findTestObject('...'), "placeHolder", "Username", 10)
"third textbox"
WebUI.verifyElementAttributeValue(findTestObject('...'), "placeHolder", "Password", 10)

Edit: if the image is associated with the text, then you may have to use RegEx, like:

"first textbox"
WebUI.verifyMatch(WebUI.getAttribute(findTestObject('...'), "placeHolder"), ".*Company", true)
"second textbox"
WebUI.verifyMatch(WebUI.getAttribute(findTestObject('...'), "placeHolder"), ".*Username", true)
"third textbox"
WebUI.verifyMatch(WebUI.getAttribute(findTestObject('...'), "placeHolder"), ".*Password", true)

or you can use ‘contains()’ in your query.

"first textbox"
WebUI.verifyMatch(WebUI.getAttribute(findTestObject('...'), "placeHolder").contains("Company").toString(), "true", false)
2 Likes

Hi grylion54
Thank you