Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Close specific tab of a site - use keyboard() or dom() + JavaScript close() #470

Closed
Fugimura opened this issue Apr 28, 2023 · 1 comment
Closed
Labels

Comments

@Fugimura
Copy link

I have a website that opens a secondary page after selecting a specific button. The point is, I would like to close this page through rpa without needing to use keyboard commands. Something like r.close(url=address), I think it's more assertive. Thanks

@kensoh
Copy link
Member

kensoh commented May 14, 2023

Hi @Fugimura, I'm afraid that there isn't a direct function to allow closure of a tab, but there is a frame() function to explicitly interact with a tab and the dom() function which you can combine to issue tab closure without using keyboard().

See this example:

r.init()
r.url('https://tebel.org')
r.click('About')
r.wait()

# specify a unique part of the URL that you want to interact with, so rpa package knows which tab you want
r.popup('about_tebel')

# use javascript close() command and dom() function to send custom javascript code to browser to close tab
r.dom('close()')

@kensoh kensoh changed the title Close specific tab of a site Close specific tab of a site - use keyboard() or dom() + JavaScript close() May 14, 2023
@kensoh kensoh added the query label May 14, 2023
@kensoh kensoh closed this as completed May 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants