Unable to Click Dynamic Button Link on Refreshing Page
Windows: 10
TestComplete Web: 12.42
Firefox: 52.0.1
I'm experiencing difficulty in writing a Keyword test to click on a link located on dynamic page that refreshes every 15 seconds. In this example the link is a "Back" button. Can someone assist? I've put the source info below and attached the object's property and method information.
If possible, I'd like to solve this via Keyword test instead of a written script. The project's base language is VBScript and it needs to work with Firefox 52 and IE 11. I understand that I may need to use "QuerySelector"; however, in a Keyword test I'm unsure how to use it to assist in clicking the dynamic link.
DYNAMIC FULLNAME EXAMPLES:
- Sys.Browser("firefox").Page("https://page.com/console/controllers/Counts?which=&rate=&zone=AAA").Panel(0).Panel("in_dialog_bottom").Panel(0).Link("back")
- Sys.Browser("firefox").Page("https://page.com/console/controllers/Counts?which=&rate=&zone=AAA&t=1521573680.191").Panel(0).Panel("in_dialog_bottom").Panel(0).Link("back")
SOURCE:
<!DOCTYPE html>
<html>
<head>
<link rel="shortcut icon" href="https://page.com/console/images/OTM_icon1.ico" />
<link rel="stylesheet" href="https://page.com/console/css/pure.min.css">
<link rel="stylesheet" href="https://page.com/console/css/ui.jqgrid.css" />
<link rel="stylesheet" href="https://page.com/console/css/jquery.ui.core.css" />
<link rel="stylesheet" href="https://page.com/console/css/jquery.ui.menu.css" />
<link rel="stylesheet" href="https://page.com/console/css/jquery.ui.autocomplete.css" />
<link rel="stylesheet" href="https://page.com/console/css/jquery.ui.resizable.css" />
<link rel="stylesheet" href="https://page.com/console/css/jquery.contextMenu.css" />
<link rel="stylesheet" href="https://page.com/console/css/jitBase.css" />
<link rel="stylesheet" href="https://page.com/console/css/Spacetree.css" />
<link rel="stylesheet" href="https://page.com/console/css/main-darkly.css" id="theme-css" />
<title id="title">Counts with Refresh Rate: 15 seconds</title>
</head>
<body class="pure-skin-darkly">
<input id="hidden-clipboard-helper" style="position: absolute; margin-top: -1000px"></input>
<!-- Before dialog-main because using absolute position and to hide red if large html in middle -->
<div class="dialog-bottom">
<div id="in-dialog-bottom" class="button-bar">
<div class="text-center">
<a id= "back" class="pure-button" href="https://page.com/console/controllers/HomePanel?zone=AAA">Back</a>
</div>
</div>
</div>
Hi,
First of all, the link provided by Marsha_R is definitely worth reading if you haven't already did that.
Then:
> I'm experiencing difficulty
What exactly?
> Can someone assist?
Quite probably. What assistance you are looking for?
> Keyword test to click on a link
Can you provide a screenshot of your test?
Without answers to the above questions, I am guessing two possible options:
a) The target link is not (stably) identified. This can be solved, for example, by proper NameMapping as per the link provided by Marsha and this video: https://support.smartbear.com/screencasts/testcomplete/reliable-tests-for-dynamic-objects/ (from the https://support.smartbear.com/screencasts/testcomplete/ page);
b) The link is identified but is lost after the page refresh because the internal content of the page is generated a-new. In this case you should not store the reference to the once found link, but search for the link just before you need to click it and click immediately. However, there is still a chance that the link will be regenerated before the click action, so, in order to improve test stability and if page refresh is not an absolute requirement for this case, I would recommend to either disable it at all or to make its frequency as low as possible.