Forum Discussion
Sounds good.
However, I apparently don't have the right syntax when I'm calling it.
I've tried both the full path: (APP_URL is replaced the actual URL in the script.) Sys.Browser("chrome").Page(APP_URL).Panel(1).Panel("BodyContainer").Panel("page_content").Panel("rightColumn").Panel("scrollable_area").Form(0).Panel(0).Panel(0).Select("RegionId").OnChange()
Or, the alias
fieldHandle.OnChange()
Aliases.browser.page16438.form.selectBureauRegion.OnChange()
But, when I call it, I get the error message:
TypeError: 'NoneType' object is not callable
So, do I need be specific to the Javascript by using iether region.change or updateOffices() or something else?
region.change(function () {
area.val("");
updateOffices();
});
Have you tried to write your own JavaSciprt function to select values from the drop-down list?
Link:
It's a kind of a workaround.
1) Run your own script, in which you will set the drop-down values
2) obtain the values
3) pass it to the TestComplete scripts
- aceataldot5 years agoNew Contributor
Based on your response, I did try something along those lines. Since my scripts were correclty setting the drop down values, I left that alone. What I tried to do was call the function that the OnChange() event calls.
I tried this:
# Enter required fields & Save
Aliases.browser.page16438.form.selectBureauRegion.value = bureauRegionId;
curPage = Sys.Browser("*").Page("*")
curPage.contentDocument.Script.updateOffices()It attempts to call the function direclty, but what I get is this:
I also tried it via eval as below:
# Enter required fields & Save
Aliases.browser.page16438.form.selectBureauRegion.value = bureauRegionId;
curPage = Sys.Browser("*").Page("*")
evalStr = "rootPath=\"" + ProjectSuite.Variables.ServerUrl + "/\"; updateOffices()"
# curPage.contentDocument.Script.eval(evalStr)When I run this, the call to updateOffices() is apparently skipped. I did enough debugging to determine that this is correct. Occasionally, it will blow up instead.
In both cases, it does not appear to find the JavaScript function. Now, updateOffices() is defined is a .js file that the page loads as part of its operation.
Do I need to do something more for it to find the function?
- aceataldot5 years agoNew Contributor
From SmartBear support we got an answer that seems to be good enough.
In short, we switched from Chrome to Firefox for the browser for these test scripts. Using Click Item in Firefox is nearly as fast as the setting the .Value directly and the JSON is automatically triggered.
Related Content
- 2 years ago
Recent Discussions
- 16 minutes ago
- 2 days ago