The Recorder Doesn't Capture the Correct Element for an Image
When a robot fails because the recorder doesn't capture the correct element for an icon or other image, you can use the built-in tools in Google Chrome to find the correct element.
Issue
A robot fails because the recorder wasn't able to capture the correct element for a graphical element, such as an icon.
Why It Happens
For some images with svg
or
img
tags, the recorder can't identify the ID. You must
target the ID, which is the element that an action acts on.
For example, consider the following options for targeting an icon and the elements that they target. None of these options records the element's ID.
Targeting option | Element that is targeted |
---|---|
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
What to Do
-
Choose any of the incorrect targeting options in the recorder.
-
Pause the recorder.
-
In the application for which you're building a robot, right-click the element you're trying to target, and select Inspect.
The DevTools appear.
-
On the Elements tab, find the element that wraps the
svg
orimg
tag. This element containsa id=
. For example: -
Copy the value that appears within the quotation marks for
id=" "
. -
Test that you've identified the correct element.
-
In DevTools, select the Console tab.
-
Type the following value, and press Enter:
document.getElementById('<value_you_copied>')
-
Type the following value, and press Enter:
document.getElementById('<value_you_copied>').click()
If the menu opens for the icon, you've targeted the correct element.
-
If the
id=" "
value is no longer in your clipboard, copy it again.
-
-
In Oracle Integration, open the target for editing.
See Update a Target.
-
Update the Locator value. For instance, paste the value that you copied between the quotation marks in the
@id=" "
value.In the Locator field, if any additional text appears after the closing bracket
]
, remove the extra text. For example, the value should be something like this:xpath://*[@id="pt1:_UISatr:0:cil1"]
-
Try running the robot again.