UFT take 5-6 minutes to to click a HTML WebElement link , Web Element is configured with css path.
Browser: iexplorer 11.2; UFT 14.01
Check the Browser Zoom. When set to anything other than 100%, the script will revert to using smart identification which takes longer to recognise.
IE browser Zoom can be reset to 100% using send keys:
Dim mySendKeys
set mySendKeys = CreateObject("WScript.shell")
mySendKeys.SendKeys("^0") ' the ^ means ctrl in sendkey method
Source: https://community.softwaregrp.com/t5/Unified-Functional-Testing-User/Configuring-browser-s-visibility-BEFORE-it-is-launched/td-p/1636797
Related
I've created a batch file that runs some VBScript which works fine in Windows 7 but not in Windows 10. Why doesn't it not work on both?
The batch file does 6 things which are listed below. On Windows 7 all 6 things happen. On Windows 10 all but item 5 take place and the window title is not changed.
opens Internet Explorer
brings the window to the foreground
navigates to a webpage
waits 1.5 seconds to allow the webpage to load
changes the window title from "MultiSmart" to "Community MultiSmart"
exits
Here is the the batch file.
<!-- :
#echo off
cscript //nologo "%~f0?.wsf" %*
exit /b
-->
<job>
<script language="VBScript">
Set ie = WScript.CreateObject("InternetExplorer.Application")
'ie properties
ie.ToolBar = 0
ie.StatusBar = 0
ie.Width = 816
ie.Height = 519
ie.Visible = 1
ie.Resizable = 0
'bring window to foreground
CreateObject("WScript.Shell").AppActivate "Internet Explorer"
'navigate to Stony Mountain Lift Station's Multismart
ie.Navigate("http://192.168.0.11/")
'wait for page to load into browser
Wscript.Sleep 1500
'change window title
ie.document.title="Community MultiSmart"
</script>
</job>
I would double check that the webpage is fully loaded.
Change this line:
Wscript.Sleep 1500
to
While IE.ReadyState < 4
Wscript.Sleep 250
Wend
It's unclear as to whether npocmaka's comment of:
"...Add metadata to force old browser behavior on windows 10."
worked for you or not. If not, then consider this alternative:
Check your security settings in IE.
Warning: This answer provides suggestions that may lower your system's security settings. It is advised that you fully understand the risks involved before proceeding and be proactive with using alternative protective measures. (Or, just stop automating in IE ☺)
Go to IE > Internet Options > Security Tab
(Optional) Add the website to your 'Trusted Sites' zone if you trust the site (which will make the next step easier on you)
Whichever zone you decided to keep site in (either 'Internet' or 'Trusted Sites'), uncheck the box: Enable Protected Mode (requires restart). Warning: This is obviously going to reduce the security of IE.
Click Apply then OK
Close out of ALL IE BROWSERS to ensure that the change takes effect
Double check Task Manager (Ctrl-Shift-Esc) to ensure no hidden iexplore.exe processes exist in the Processes tab.
Test the end result
If still doesn't work, ensure you reverse any settings.
Scripting can obviously be dangerous to any system, which is why Protected mode may severely limit what you can do with automation. I believe that IE didn't enable protected mode in IE by default until Windows 8(.1)?, but I don't have a source for my suspicions; if this is the case, that would be why it works on Windows 7 and not Windows 10.
You can still do simple things with protected mode enabled, but it's severely limited. For example, you can still navigate to web pages, but many of IE's other properties and methods are disabled.
I'm re-posting npocmaka's comment which answered my question as an answer.
because it depends on the internet explorer version
The versions were different. What worked on IE 11.0.966.18920 did not on IE 11.461.16299.0.
I'm trying to run some automation tests in my application but the UFT Hidden-mode notification tooltip is coming in front of the objects in the screen, preventing my tests to run.
I know I can un-check the option "Display hidden-mode notification tooltip" in Remote Agent Settings to fix this issue and it works fine on my machine after I do this, but these tests are executed in other machines, by other users in my company, and it would be a real effort to tell each and everyone of them to change this setting on their machine.
Is it a way to disable this checkbox programmaticaly instead?
EDIT:
Here is a little more detail on where this is affecting me:
I'm testing a Web application and in some of my test cases I need to download a file from this application. I do that by clicking on "Save As" in the context menu which is displayed on a notification bar at the bottom of the browser.
Following is the portion of code to perform such operation:
Dim brwBottom
Set brwBottom = Browser("brw_Bottom_Save_As")
If brwBottom.WinObject("wo_Notification").WinButton("wb_Selector").Exist Then
brwBottom.WinObject("wo_Notification").WinButton("wb_Selector").Click
brwBottom.WinMenu("wm_Selector").Select "Save As"
End If
This works fine on my machine because UFT notification is not being displayed, but in other machines where the UFT Notification is displayed, it overlaps the menu and my script is unable to select the "Save As" option. So, in case it is not possible to programmatically close this notification at runtime, is there any alternative solution to click on the "Save As" button, even with this notification overlapping it?
I managed to identify the UFT Notification tooltip and close it. With this, there is no more objects in front of the button I need to click and my script can be executed successfully.
Following is the code used. I'm not marking this as the acceptable answer yet because I am still waiting for my team to accept the solution, but this works.
Dim brwBottom
Set brwBottom = Browser("brw_Bottom_Save_As")
' To close UFT Notification Tooltip, if exists
If Window("regexpwndtitle:=NotificationWindow").Exist(2) Then
If InStr(Window("regexpwndtitle:=NotificationWindow").GetROProperty("nativeclass"),"UFTRemoteAgent") > 0 Then
Window("regexpwndtitle:=NotificationWindow").Close
End If
End If
If brwBottom.WinObject("wo_Notification").WinButton("wb_Selector").Exist Then
brwBottom.WinObject("wo_Notification").WinButton("wb_Selector").Click
brwBottom.WinMenu("wm_Selector").Select "Save As"
End If
Create UFT GUI test and include these three lines:
extern.Declare micLong, "WritePrivateProfileString", "kernel32.dll", "WritePrivateProfileString", micString, micString, micString, micString
extern.WritePrivateProfileString "RemoteAgent", "ShowBallon", "0", Environment("ProductDir") + "\bin\mic.ini"
systemutil.CloseProcessByName "UFTRemoteAgent.exe"
From ALM, run it on all your UFT machines.
Notes:
This will switch the flag that controls such tooltip to be off, so next time Remote Agent launches will read it and won't display the tooltip anymore.
The third line will kill UFT's remote agent for GUI testing which is in charge of the communication between UFT and ALM Client and this will cause an error in ALM's Automatic Runner (The RPC server is unavailable)... just ignore it. We need to kill it so it is re-launched next time we try to run a test from ALM (as mentioned above, new value for tooltip will be read)
EDIT:
I just found something interesting: this flag is actually saved in two locations:
mic.ini
RemoteAgentGUISettings.xml
but the one that actually makes the change effective is RemoteAgentGUISettings.xml (it seems they're switching from .ini files to .xml... which makes sense). In this case, the code will change a little, but the idea is the same:
filePath = CreateObject("WScript.Shell").ExpandEnvironmentStrings("%appdata%") + "\Hewlett-Packard\UFT\Persistence\Dialogs\RemoteAgentGUISettings.xml"
Set xmlDoc = CreateObject("Microsoft.XMLDOM")
xmlDoc.load filePath
Set nNode = xmlDoc.selectsinglenode ("//SettingsViewModel/IsShowBalloon")
nNode.text = "false"
strResult = xmldoc.save(filePath)
systemutil.CloseProcessByName "UFTRemoteAgent.exe"
This time I made sure it works ;)
I totally understand your pain because my projects also need to interact with IE download bar. Usually, I use SendKeys to handle download activity in different projects.
When download bar comes out, you can send ALT+N first to set focus on download bar, then send some tab keys to select on Save, and some Down Arrow key to select SaveAs.
In this way, you don't need to bother handle UFT notifications...
Sample SendKeys codes can be easily Googled.
Can you activate the desired browser with the following, and then try to do Save as
hwnd = Browser("title:=.*").GetROProperty("hwnd")
Window("hwnd:=" & hwnd).Activate
I have a Google Analytics Macro that works perfectly fine in Windows, but I need to use it in MAC.
I am having trouble with opening a browser and navigating in it. This is an example of code that I use and didn't find support in MAC:
Set HTMLDoc = oIExplorer.document
HTMLDoc.all.Email.Value = GAlogin ‘this is a string I got in another part of the code
HTMLDoc.all.passwd.Value = GApassword ‘this is a string I got in another part of the code
For Each objButton In HTMLDoc.getElementsByTagName("input")
If objButton.Type = "submit" Then
objButton.Click
Exit For
End If
Next objButton
I found ways to open and navigate browser, but none of them would support this kind of code. More specifically, none of them allowed the getElementsByTagName part nor going through the elements and clicking a button.
Does anyone know how I could navigate and use a browser in MAC that would support this functions?
I am trying to run watir scripts on Wndows 7 on IE8 as administrator.
Here is problem description:
Problem was with below statement(popup windows)
popup = Watir::IE.attach(:url, /ContactDetails/)
and Error message was Unable to locate the url(ContactDetails)
The issue seems to be that when there already exists an instance of IE8 that was opened with administrative privs, Watir won't see any other IE8 windows that are being run as admin, including ones it opens itself.
Fix that i have been doing:
Turn off User Account Control (set to the lowest setting). Go to Control Panel->System and Security->Action Center->Change User Account Control settings, and drop the slider to the lowest setting.
But this is not a permanent fix, i have to change the windows 7 settings every day to run my automation script.
Can anyone help me finding out the permanent solution ?
As far as I know, watir-webdriver does not have IE class and attach method.
Have you tried to attach via the title of the page? for example:
browser2 = Watir::IE.attach(:title, "Google")
if the browser you wanted to attach to was Googles home page.
Look at the source code and
put whatevers inbetween the title tags on your page.
Google
Webpage error details
User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727)
Timestamp: Wed, 18 Jan 2012 05:02:49 UTC
Message: HTML Parsing Error: Unable to modify the parent container element before the child element is closed (KB927917)
Line: 0
Char: 0
Code: 0
URI: http://collaborize.collaborizeclassroom.com/portal/portal/collaborize/site/window?actionEvent=homePage&action=2&fpg=1&unId=umb8N95lhIoXOVKzTTrtcPoCrixd4wMdScQv8mEwqFT962zy3VSh4mzQNeugOWVV&ts=1326862916939&publishUrl=class2&siteName=class2&siteId=20941
I get the above problem only when i open and close the browser and log-in for the first time and even though i delete cache,cookies and history and login again i don't get the problem.
is there something else other than the above that gets deleted when we close the browser because the error only comes when i login the first time after i open the browser
Example: call document.body.appendChild when the page has not loaded.
Need to call javascript when the page is loaded, example:
document.body.onload = function()
{
document.body.appendChild(...)
}
Add few characters spaces in-between script tags to fix this.
ie., space inbetween start and close script tags in case you are referring outside library using src attribute
IE takes some time to render elements. In that case, if we are referencing the element in Javascript it will throw this error.
Solution is to check on your Javascript or Jquery codes and use the codes inside the $(document).ready(function() { } function.
It works for me.
This is a bug in IE8.try following the method provided below. After using this my problem is resolved.
Reset your Internet Explorer settings and run it. You can do this by following the steps given below.
If the problem is caused by damaged or incompatible Internet Explorer settings or add-ons, you can usually resolve the problem by resetting Internet Explorer settings.
To use the Reset Internet Explorer Settings feature from Control Panel, follow these steps:
First of all clear your IE history.
Exit all programs, including Internet Explorer (if it is running).
If you use Windows XP, click Start, and then click Run. Type the following command in the Open box, and then press ENTER:
inetcpl.cpl
If you use Windows Vista, click Start Collapse this imageExpand this image . Type the following command in the Start Search box, and then press ENTER:
inetcpl.cpl
The Internet Options dialog box appears.
Click the Advanced tab.
Under Reset Internet Explorer settings, click Reset. Then click Reset again.
When Internet Explorer finishes resetting the settings, click Close in the Reset Internet Explorer Settings dialog box.
After that you have to download the Cumulative Security update for Internet Explorer KB2360131 to resolve this.
http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=27630 (Windows XP)
OR
http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=27622 (Windows Vista)
-- Start Internet Explorer again.
Not sure if this will be on any help but it might give you an idea of your problem.
I'm still learning js but I got the same problem and only in IE8. I had suspicion that it was the facebook plugin I got from facebook which stated to place the code at the top of page. I removed the code and page loaded without error then added it back and I got the error. I moved the code to the bottom of the page and it worked with no errors. The page even loaded faster.
I added the $(document).ready(...) and still had a problem. After further analysis, I isolated the problem to an em value in a CSS media query (I am using respond.js). I have not investigate the root cause further, but I was able to consistently view the page without errors after switching the media query from ems to pixels.
The problem happens when JS tried to appendChild to a DOM element that has not finished loading. I fixed with
window.onload=function() {
//append code
}
if the issue is still happening within here I would surmise that the ready code is creating new elements and trying to append children to them before they are loaded.
To solve the issue:
Please check your source codes, that all the HTML tags are opened and closed properly.
If all are fine then you will not get this kind of errors in IE.