Skip to content
This repository has been archived by the owner on Nov 29, 2018. It is now read-only.

Allow webdriver to attach to a running browser #18

Closed
lukeis opened this issue Mar 2, 2016 · 45 comments
Closed

Allow webdriver to attach to a running browser #18

lukeis opened this issue Mar 2, 2016 · 45 comments

Comments

@lukeis
Copy link
Member

lukeis commented Mar 2, 2016

Originally reported on Google Code with ID 18

It should be possible to attach webdriver to a running browser instance.

Reported by simon.m.stewart on 2009-12-01 15:25:41

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

To me it would be even more useful to be able to attach webdriver to an existing
window (e.g. in a popup opened from another page). I'll still had my vote on this issue.

Reported by bdoncieu on 2010-05-05 10:32:20

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

Reported by jari.bakken on 2010-06-17 00:07:44

  • Labels added: Component-WebDriver

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

I agree - ability to attach to existing session or better yet, switching between sessions
at will would be of great use.

Reported by piotr.dudala on 2010-06-23 09:17:16

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

This feature will help us a lot on unit testing and debugging on the code for a particular
page.

Reported by duyongze on 2010-07-22 13:46:00

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

Ya I definitely need this too.

Reported by brettcsykes on 2010-07-22 13:49:37

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

agree can someone get this added :)

Reported by taswar on 2010-07-22 13:54:45

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

I'll add my 2cents and say I really could use this as well.  I have a browser page that
acts as a menu to kick of various reports and other functions. I'd like my test suite
to start the browser and go to the menu page. From there each test case/class tests
a report. But I'd like to also run the tests ad hoc, running each test from the menu
page without starting/stopping the browser each time.

Reported by sosha@trnswrks.com on 2010-08-16 15:13:35

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

I also really need this capability. I am trying to port an existing test suite from
Watir. I have tests that look for the presense of popups as well as test their content.
Being able to attach to another window is essential and will allow me to upgrade to
the watir webdriver api.

Reported by leonashleydavis on 2010-08-29 00:33:40

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

leonashleydavis: That sounds like a different use case. Although it's not exposed in
watir-webdriver (yet), you can access the underlying Driver instance and use its API
to switch between windows, e.g.:

>> b = Watir::Browser.new :firefox
=> #<Watir::Browser:0xf10318 url="about:blank" title="">
>> b.driver.window_handle
=> "{f5da02dc-6c66-481e-85b4-6aea9973b44c}"
>> b.driver.window_handles
=> ["{f5da02dc-6c66-481e-85b4-6aea9973b44c}", "{2d99ce5c-b4c9-4ec0-8edc-7ec59ba10cd0}"]
>> b.driver.switch_to.window("{2d99ce5c-b4c9-4ec0-8edc-7ec59ba10cd0}")
=> "d74e5e46-7c4c-42db-979b-d5f80ed5c6b3"
>> b.driver.window_handle
=> "{2d99ce5c-b4c9-4ec0-8edc-7ec59ba10cd0}"
>> 

If you have suggestions for what a Watir API for this should look like, please comment
on this issue: http://github.com/jarib/watir-webdriver/issues/issue/34

Reported by jari.bakken on 2010-08-29 11:41:51

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

Can I also attach to a browser that was not started by Watir?

This is possible with standard Watir. 

Reported by markus.kohler on 2010-10-12 08:07:28

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

I agree with this.  I could really use this for our Company.  This would allow us to
automate the starting of the browser and get around some of the screens that are not
currently supported by the webdriver.  Then we could attach the webdriver to the browser
and run from selenium from that point.

Reported by Larry.M.McHale on 2010-12-01 15:05:12

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

Simon, lets chat about this tomorrow. I think we can get a hold of it by storing a PID
when we launch and the sessionId.

Reported by antlong on 2011-01-21 00:58:27

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

Simon, do you think this is some thing that could be included in the upcoming Beta 2
release. Seems like with the new rewritten IE driver if you expose few methods this
should be possible.  I could really use this for our company as well.

Reported by sridurgadevi on 2011-01-25 22:37:57

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

The IE driver was rewritten to make this scenario easier, but without an exposed API
in Selenium/WebDriver, we don't have any way to make it happen. You probably won't
see this API exposed for beta 2.

Reported by james.h.evans.jr on 2011-01-25 22:45:48

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

agree

Reported by SMatvejko on 2011-03-03 08:57:19

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

You may be interested in what I have implemented as PersistentWebdriver class that allows
to attach to a running session:

https://gist.github.com/852560

Reported by Dmytro.Nedbaylo on 2011-03-03 09:43:01

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

Note: it is tested only with Firefox (on ubuntu)

Reported by Dmytro.Nedbaylo on 2011-03-03 09:45:57

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

I implemented this in se1, feel free to take a look.

github.com/antlong/selenium

Reported by antlong on 2011-03-03 15:52:23

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

Was this feature included in beta 3? if Not when is it likely to be part of the selenium
API? this is a very useful feature

Reported by reachnattu on 2011-03-29 04:54:48

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

I also need this feature as my browser is embedded in another application.

Reported by locketine on 2011-04-20 21:31:12

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

Would be a very handy feature. Our is a web start application. This feature would help
us a lot.

Reported by rohith.vishwanath on 2011-04-23 16:21:18

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

This feature is critical for test cases where part of the test requires manual intervention,
then we need the automated test driver to take over for a while.

Reported by huttarl on 2011-04-26 15:07:03

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

Reported by antlong on 2011-04-26 15:14:08

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

Seconding #19 ... when will we see this feature in the beta or in release?

Thank you Anthony for implementing it!

Reported by huttarl on 2011-04-26 15:16:51

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

I am also very interested in this feature.

Reported by alportac on 2011-06-08 21:45:49

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

I think it would be great if we could get handle to the pened browser session. Since
my project require the check the flow in various stages for thar i have to swith between
the applications.

Reported by cjshinde on 2011-06-14 15:23:08

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

This feature will be very useful as an recovery process for all automation scripts we
have.

Reported by jraghavan on 2011-06-14 23:02:56

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

This would be awesome! There are a few parts of our native application that open a browser.
From there it would be really nice to let Selenium take over and continue with the
automation.

Reported by gnusnews on 2011-07-27 01:33:22

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

This would be a great feature. This feature will help QA to write test scripts in much
faster way. It allows users to work on any web page by simply attaching that browser
page to the respective webdriver by passing brower "Title" rather starting from first
page. I am not sure whether should I attach sample code or not. I used this technique
with WATIN as mentioned below:

// Get the focused browser window title
String WinTitle = NativeWin32.GetText(NativeWin32.GetForegroundWindow()).Substring(0,
NativeWin32.GetText(NativeWin32.GetForegroundWindow()).LastIndexOf('-')).Trim();

// Attach this page to IE browser
driver = IE.AttachTo<IE>(Find.ByTitle(WinTitle));

Reported by haki12 on 2011-08-14 06:45:19

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

This would be an awesome feature to add, and really help with test debugging so a user
can isolate and run a single step instead of having to run the test from the beginning.

Reported by nathandace on 2011-09-09 18:44:03

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

Really need this feature soon!! It will be very useful..

Reported by vishalsadaphal on 2011-09-09 20:38:07

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

Anthony, thank you for implementing this; I'm a Java newbie, could you or another poster
give an example of instantiating this PersistentWebdriver class?  I'm still using the
old WebDriver with Firefox that had this feature, but will upgrade once I can get the
class to work for me.  Thanks much!

Also, why was this feature removed from WebDriver when it worked in earlier versions?

Reported by frank.seipel6 on 2011-09-15 11:03:19

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

Issue 2507 has been merged into this issue.

Reported by dawagner on 2011-09-23 15:30:10

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

This feature would save a lot of time and nerves of automated testers. Alternatively
could anyone post a workaround for C#?

Reported by andr.simonov on 2011-09-30 15:09:50

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

this would be a great feature for me too

Reported by WuZengDe on 2011-10-07 03:29:23

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

Reported by dawagner on 2011-10-09 20:45:52

  • Labels added: Restrict-AddIssueComment-Commit

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

Issue 3121 has been merged into this issue.

Reported by james.h.evans.jr on 2011-12-27 10:23:38

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

Issue 3229 has been merged into this issue.

Reported by james.h.evans.jr on 2012-01-19 09:55:16

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

Issue 3457 has been merged into this issue.

Reported by david.burns@theautomatedtester.co.uk on 2012-02-29 00:19:32

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

Issue 2163 has been merged into this issue.

Reported by david.burns@theautomatedtester.co.uk on 2012-05-05 21:09:43

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

Issue 3538 has been merged into this issue.

Reported by barancev on 2012-05-10 21:18:01

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

Issue 3927 has been merged into this issue.

Reported by barancev on 2012-05-18 10:57:08

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

Issue 6417 has been merged into this issue.

Reported by barancev on 2013-10-18 08:11:16

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

I'm going to make a call on this one: it's a browser specific feature, and not something
that we can implement in a general way. With IE, it's possible to iterate over the
open windows in the OS and find the right IE process to attach to.

Firefox and Chrome, OTOH, need to be started in a specific mode and configuration,
which means that just attaching to a running instance isn't technically possible.

Closing as "not feasible" here as this is a browser specific feature.

Reported by simon.m.stewart on 2014-01-29 16:45:02

  • Status changed: NotFeasible

@lukeis
Copy link
Member Author

lukeis commented Mar 2, 2016

Issue 7004 has been merged into this issue.

Reported by james.h.evans.jr on 2014-02-19 10:36:46

@lukeis lukeis closed this as completed Mar 2, 2016
@SeleniumHQ SeleniumHQ locked and limited conversation to collaborators Mar 3, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant