How do I switch windows using handles? switch_to_window() does not
work since it needs name. [self.execute(Command.SWITCH_TO_WINDOW,
{'name': window_name})]
#webdriver.__version__
#'2.11.0'
b=webdriver.Firefox()
b.current_window_handle
u'{fe621e9c-b0b4-4649-9b90-16badf98f6e9}'
hs = b.window_handles
Then ??
Thanks.
s = set(b.window_handles)
s.remove(b.current_window_handle)
b.switch_to_window(s.pop())
-Luke
> --
> You received this message because you are subscribed to the Google Groups "Selenium Users" group.
> To post to this group, send email to seleniu...@googlegroups.com.
> To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/selenium-users?hl=en.
>
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/
remote/webdriver.py", line 487, in switch_to_window
self.execute(Command.SWITCH_TO_WINDOW, {'name': window_name})
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/
remote/webdriver.py", line 151, in execute
response = self.command_executor.execute(driver_command, params)
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/
remote/remote_connection.py", line 267, in execute
return self._request(url, method=command_info[0], data=data)
File "/usr/local/lib/python2.7/dist-packages/selenium/webdriver/
remote/remote_connection.py", line 308, in _request
response = opener.open(request)
File "/usr/lib/python2.7/urllib2.py", line 394, in open
response = self._open(req, data)
File "/usr/lib/python2.7/urllib2.py", line 412, in _open
'_open', req)
File "/usr/lib/python2.7/urllib2.py", line 372, in _call_chain
result = func(*args)
File "/usr/lib/python2.7/urllib2.py", line 1201, in http_open
return self.do_open(httplib.HTTPConnection, req)
File "/usr/lib/python2.7/urllib2.py", line 1174, in do_open
r = h.getresponse(buffering=True)
File "/usr/lib/python2.7/httplib.py", line 1027, in getresponse
response.begin()
File "/usr/lib/python2.7/httplib.py", line 407, in begin
version, status, reason = self._read_status()
File "/usr/lib/python2.7/httplib.py", line 371, in _read_status
raise BadStatusLine(line)
httplib.BadStatusLine: ''
Any ideas?
On Nov 30, 4:02 pm, Luke Inman-Semerau <luke.seme...@gmail.com> wrote:
> If you have more than one window and you switch to one of the other ones
>
> s = set(b.window_handles)
> s.remove(b.current_window_handle)
> b.switch_to_window(s.pop())
>
> -Luke
>
Luke and Kenneth: Thank you for your time.
On Dec 1, 11:22 am, Luke Inman-Semerau <luke.seme...@gmail.com> wrote:
> Can you let me know what browser version / os / selenium version you are
> using and a url or sample html that reproduces this?
>