You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want a way to fork a Browser state, by calling something like browser_copy = browser.copy(), and then being able to work from browser_copy, while eventually going back to the un-touched browser.
Why I want it
I was writing a scraper for a file browser site. To download files, you first navigate to a specific folder, then you click on each file. I wanted to fork/copy the browser before clicking on each file download link, but couldn't.
What I tried
importcopybrowser_copy=copy.copy(browser) # works on the first use, but not afterbrowser_copy=deepcopy.copy(browser) # crashes here, as it can't copy recursive elements
What I want
I want you to add a browser.copy() or browser.fork() method, which returns a fork of the browser with the same active page, same selected from, same session, etc., which can then be navigated independently from there. This would be similar to duplicating a tab in a GUI web browser, presumably.
The text was updated successfully, but these errors were encountered:
Hi, thanks for the detailed feature request! If you're just looking to retain the current state when you click on a download link, perhaps take a look at StatefulBrowser.download_link. This method doesn't change the browser state. Would this work for you?
Great suggestion. I ultimately did go with something similar to that. The issue was that, from the folder listing page, you had to click on each file, and only then was a download link revealed. Using download_link doesn't give you the full link listing functionality, etc., which is why I think this is a useful feature.
Ah, I see, thanks for the clarification. Yes, in that case a back button or a state cloning method could be helpful.
As a workaround for now, you might be able collect all the links from the main page, and then in a loop visit each subpage to get the download links. (Though it sounds like you might already be doing something like this.)
I want a way to fork a Browser state, by calling something like
browser_copy = browser.copy()
, and then being able to work frombrowser_copy
, while eventually going back to the un-touchedbrowser
.Why I want it
I was writing a scraper for a file browser site. To download files, you first navigate to a specific folder, then you click on each file. I wanted to fork/copy the browser before clicking on each file download link, but couldn't.
What I tried
What I want
I want you to add a
browser.copy()
orbrowser.fork()
method, which returns a fork of the browser with the same active page, same selected from, same session, etc., which can then be navigated independently from there. This would be similar to duplicating a tab in a GUI web browser, presumably.The text was updated successfully, but these errors were encountered: