Esempio n. 1
0
    def switch_to_window(self, window_name=None, title=None, url=None):
        if window_name:
            self._get_seleniums_driver_class().switch_to_window(self, window_name)
            return

        if url:
            if not isinstance(url, dict):
                url = {'path': url}
            url.setdefault('domain', gotopage._get_domain_from_driver(self))
            url = gotopage._make_url(**url)

        for window_handle in self.window_handles:
            self._get_seleniums_driver_class().switch_to_window(self, window_handle)
            if title and self.title == title:
                return
            if url and self.current_url == url:
                return
        raise NoSuchWindowException('Window (title=%s, url=%s) not found.' % (title, url))
 def _get_url_and_data(self):
     domain = _get_domain_from_driver(self._driver)
     url = _make_url(path=self._url, domain=domain)
     return url, None
 def test_make_url(self):
     url = _make_url('path', 'qu=ery', 'example.com')
     self.assertEquals(url, 'http://example.com/path?qu=ery')
 def test_make_url_not_pass_protocol(self):
     url = _make_url(domain='example.com')
     self.assertEquals(url, 'http://example.com')
 def test_make_url_query_as_dictionary(self):
     url = _make_url(query={'qu': 'ery'})
     self.assertEquals(url, 'http://?qu=ery')
 def test_make_url_query_as_string(self):
     url = _make_url(query='qu=ery')
     self.assertEquals(url, 'http://?qu=ery')
 def _get_url_and_data(self):
     domain = _get_domain_from_driver(self._driver)
     url = _make_url(path=self._url, domain=domain)
     return url, None
 def test_make_url(self):
     url = _make_url('path', 'qu=ery', 'example.com')
     self.assertEquals(url, 'http://example.com/path?qu=ery')
 def test_make_url_not_pass_protocol(self):
     url = _make_url(domain='example.com')
     self.assertEquals(url, 'http://example.com')
 def test_make_url_query_as_dictionary(self):
     url = _make_url(query={'qu': 'ery'})
     self.assertEquals(url, 'http://?qu=ery')
 def test_make_url_query_as_string(self):
     url = _make_url(query='qu=ery')
     self.assertEquals(url, 'http://?qu=ery')