My test scenario clicks the button that follows to the new tab of the browser, after verifying that we got the right page I need to close this tab and return to the first tab. How could I close the actual tab? I tried to use Close Window, but it closes the entire browser?
This code can help you open new tab and close that's new tab by and return to your first tab.
*** Test Cases ***
T1
Open Browser ${URL} ${BROWSER}
click element name=btn
${title_var} Get Window Titles
Select Window title=@{title_var}[1]
close window
you can use below code to close active window and back to main window
${windowhandles}= Get Window Handles
Switch Window ${windowhandles}[1]
close window
Switch Window ${windowhandles}[0]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With