QTP won’t recognize IE9 Download bar

  • Questions
  • QTP won't recognize IE9 Download bar
Question ID: 104770
1
0

I need to automate downloading a file, but I need to use the Save As button to put the file in a specific location. It doesn’t work. QTP won’t access the Save As object.

Marked as spam
Posted by (Questions: 344, Answers: 24)
Asked on December 19, 2012 5:02 pm
30 views
Answers (2)
1
Private answer

In KM1121645, HP has stated, ''(Internet Explorer 9 and newer) The Download Notification Bar feature included on this version uses new controls, not supported by QuickTest Professional.'' In the article, they include some code as a work-around. However, the code they supplied is dependent on browser size and location and screen resolution. This makes results inconsistent.

The below code will access the Save As object regardless of the screen resolution and browser size.

'This will highlight the download bar to grab focus on it.

Set DeviceReplay = CreateObject(''Mercury.DeviceReplay'') Browser(''creationtime:=0'').WinObject(''nativeclass:=DirectUIHWND'',''regexpwndclass:=DirectUIHWND'', ''index:=0'').highlight

'This will right-click the save button to put focus on it.

Browser(''creationtime:=0'').WinObject(''nativeclass:=DirectUIHWND'',''regexpwndclass:=DirectUIHWND'', ''index:=0'').Clickontext ''Save'',,,,,true,micRightBtn,true

'This will press the 'down arrow' then the 'a' key to activate the drop-down button and then activate the Save As command.

DeviceReplay.PressKey 208 'Presses 'down arrow' key
DeviceReplay.PressKey 30 'Presses 'a' key
Set DeviceReplay = Nothing

Marked as spam
Posted by (Questions: 16, Answers: 754)
Answered on December 19, 2012 5:28 pm
This is exactly what I needed! Thanks!
( at December 19, 2012 5:38 pm)
1
Private answer

Very good post. Worked like charm. Thanks..

Marked as spam
Posted by (Questions: 0, Answers: 1)
Answered on March 18, 2013 3:42 pm