forked from cobrateam/splinter
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_webdriver_remote.py
More file actions
78 lines (60 loc) · 2.42 KB
/
test_webdriver_remote.py
File metadata and controls
78 lines (60 loc) · 2.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# -*- coding: utf-8 -*-
# Copyright 2013 splinter authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
try:
from urllib import urlopen
except ImportError:
from urllib.request import urlopen
import unittest
from splinter import Browser
from .fake_webapp import EXAMPLE_APP
from .base import WebDriverTests
def selenium_server_is_running():
try:
from splinter.driver.webdriver.remote import WebDriver
page_contents = urlopen(WebDriver.DEFAULT_URL).read()
except IOError:
return False
return 'WebDriver Hub' in page_contents
class RemoteBrowserTest(WebDriverTests, unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.browser = Browser("remote")
@classmethod
def tearDownClass(cls):
cls.browser.quit()
def setUp(self):
self.browser.visit(EXAMPLE_APP)
def test_support_with_statement(self):
"Remote should support with statement"
with Browser('remote') as remote:
pass
def test_mouse_over(self):
"Remote should not support mouseover"
with self.assertRaises(NotImplementedError):
self.browser.find_by_id('visible').mouse_over()
def test_mouse_out(self):
"Remote should not support mouseout"
with self.assertRaises(NotImplementedError):
self.browser.find_by_id('visible').mouse_out()
def test_double_click(self):
"Remote should not support double_click"
with self.assertRaises(NotImplementedError):
self.browser.find_by_id('visible').double_click()
def test_right_click(self):
"Remote should not support right_click"
with self.assertRaises(NotImplementedError):
self.browser.find_by_id('visible').right_click()
def test_drag_and_drop(self):
"Remote should not support drag_and_drop"
with self.assertRaises(NotImplementedError):
droppable = self.browser.find_by_css('.droppable')
self.browser.find_by_css('.draggable').drag_and_drop(droppable)
def test_mouseover_should_be_an_alias_to_mouse_over(self):
"Remote should not support mouseover"
with self.assertRaises(NotImplementedError):
self.browser.find_by_id('visible').mouseover()
def test_should_be_able_to_change_user_agent(self):
"Remote should not support custom user agent"
pass