How can I close an IE Tab during testing
SOLVED- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How can I close an IE Tab during testing
When recording a keyword test, I click and option and it opens a PDF file to view, so once I viewed I closed out the new tab to get to my original tab. Test complete is failing on this step. How can I get it to close an IE tab?
Solved! Go to Solution.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
def test11():
Aliases.browser.Page("*", 0).Close()
assuming that the focused control is on the browser tab that we want to close, the above code should work
Justin Kim
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Do I convert my key test into a script and just copy and paste the code you provided?
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
or you can save the script routine and drag and drop it into your keyword test workspace where you need to perform that action
Justin Kim
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The following code will take a browser that is open to Google.com and open a new tab, then nagivate to eyeontesting.com on the new tab, then will close just the google.com tab. Modify for your needs...
'Browser is open to Google.com
Browser(''Google'').Page(''Google'').WebEdit(''q'').Set ''eyeontesting''
Browser(''Google'').Page(''orasi - Google Search'').WebButton(''btnG'').Click
Browser(''Google'').OpenNewTab
Browser(''Browser'').Page(''Page'').Sync
Browser(''Browser'').Navigate ''eyeontesting.com''
CloseBrowserByTitle ''Google'', true
Sub CloseBrowserByTitle(title, isregex)
Set desc = Description.Create()
desc(''title'').Value = title
desc(''title'').RegularExpression = isregex
desc(''index'').Value = ''0''
While Browser(desc).Exist(5)
Browser(desc).Close
Wend
End Sub
