Codebase list splinter / 8782576
Initial packaging Sophie Brun 4 years ago
10 changed file(s) with 292 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
0 splinter (0.13.0-0kali1) kali-dev; urgency=medium
1
2 * Initial release
3
4 -- Sophie Brun <[email protected]> Tue, 21 Jan 2020 15:53:06 +0100
0 Source: splinter
1 Section: python
2 Priority: optional
3 Maintainer: Kali Developers <[email protected]>
4 Uploaders: Sophie Brun <[email protected]>
5 Build-Depends: debhelper-compat (= 12), dh-python, python3-setuptools, python3-all, python3-sphinx, python3-sphinx-rtd-theme, python3-pytest, python3-selenium, python3-django, python3-flask
6 Standards-Version: 4.4.1
7 Homepage: https://github.com/cobrateam/splinter
8 Vcs-Browser: https://gitlab.com/kalilinux/packages/splinter
9 Vcs-Git: https://gitlab.com/kalilinux/packages/splinter.git
10 Testsuite: autopkgtest-pkg-python
11
12 Package: python3-splinter
13 Architecture: all
14 Depends: ${python3:Depends}, ${misc:Depends}
15 Suggests: python-splinter-doc
16 Description: Python test framework for web applications (Python 3)
17 This package contains an open source tool for testing web applications using
18 Python. It lets you automate browser actions, such as visiting URLs and
19 interacting with their items.
20 .
21 This package installs the library for Python 3.
22
23 Package: python-splinter-doc
24 Architecture: all
25 Section: doc
26 Depends: ${sphinxdoc:Depends}, ${misc:Depends}
27 Description: Python test framework for web applications (common documentation)
28 This package contains an open source tool for testing web applications using
29 Python. It lets you automate browser actions, such as visiting URLs and
30 interacting with their items.
31 .
32 This is the common documentation package.
0 Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
1 Upstream-Name: splinter
2 Source: https://github.com/cobrateam/splinter
3
4 Files: *
5 Copyright: 2012, splinter authors
6 License: BSD-3-clause
7
8 Files: debian/*
9 Copyright: 2020 Sophie Brun <[email protected]>
10 License: BSD-3-clause
11
12 License: BSD-3-clause
13 All rights reserved.
14 .
15 Redistribution and use in source and binary forms, with or without
16 modification, are permitted provided that the following conditions are
17 met:
18 .
19 * Redistributions of source code must retain the above copyright notice,
20 this list of conditions and the following disclaimer.
21 .
22 * Redistributions in binary form must reproduce the above copyright notice,
23 this list of conditions and the following disclaimer in the
24 documentation and/or other materials provided with the distribution.
25 .
26 * Neither the name of Splinter nor the names of its contributors may be used
27 to endorse or promote products derived from this software without
28 specific prior written permission.
29 .
30 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
31 IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
32 THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
33 PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
34 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
35 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
36 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
37 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
38 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
39 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
40 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
0 From: Sophie Brun <[email protected]>
1 Date: Tue, 21 Jan 2020 17:36:34 +0100
2 Subject: Import upstream patch 1
3
4 ---
5 splinter/browser.py | 6 ++++--
6 splinter/driver/lxmldriver.py | 10 ++++++++--
7 splinter/driver/webdriver/__init__.py | 5 ++++-
8 splinter/driver/zopetestbrowser.py | 5 ++++-
9 tests/element.py | 6 ++++++
10 tests/find_elements.py | 5 +++++
11 tests/static/index.html | 2 ++
12 tests/test_browser.py | 15 +++++++++++++++
13 8 files changed, 48 insertions(+), 6 deletions(-)
14
15 diff --git a/splinter/browser.py b/splinter/browser.py
16 index a1cbfdd..e8b4543 100644
17 --- a/splinter/browser.py
18 +++ b/splinter/browser.py
19 @@ -59,13 +59,15 @@ def get_driver(driver, retry_count=3, *args, **kwargs):
20 This can mitigate issues running on Remote WebDriver.
21
22 """
23 + err = None
24 +
25 for _ in range(retry_count):
26 try:
27 return driver(*args, **kwargs)
28 except (IOError, HTTPException, WebDriverException, MaxRetryError) as e:
29 - pass
30 + err = e
31
32 - raise e
33 + raise err
34
35
36 def Browser(driver_name="firefox", retry_count=3, *args, **kwargs):
37 diff --git a/splinter/driver/lxmldriver.py b/splinter/driver/lxmldriver.py
38 index 886d145..de8f4af 100644
39 --- a/splinter/driver/lxmldriver.py
40 +++ b/splinter/driver/lxmldriver.py
41 @@ -179,9 +179,12 @@ class LxmlDriver(ElementPresentMixIn, DriverAPI):
42 )
43
44 def find_by_value(self, value):
45 - return self.find_by_xpath(
46 + elem = self.find_by_xpath(
47 '//*[@value="%s"]' % value, original_find="value", original_selector=value
48 )
49 + if elem:
50 + return elem
51 + return self.find_by_xpath('//*[.="%s"]' % value)
52
53 def find_by_text(self, text):
54 xpath_str = _concat_xpath_from_str(text)
55 @@ -412,7 +415,10 @@ class LxmlControlElement(LxmlElement):
56
57 @property
58 def value(self):
59 - return self._control.value
60 + try:
61 + return self._control.value
62 + except AttributeError:
63 + return self._control.text
64
65 @property
66 def checked(self):
67 diff --git a/splinter/driver/webdriver/__init__.py b/splinter/driver/webdriver/__init__.py
68 index cc6f852..8f52138 100644
69 --- a/splinter/driver/webdriver/__init__.py
70 +++ b/splinter/driver/webdriver/__init__.py
71 @@ -572,12 +572,15 @@ class BaseWebDriver(DriverAPI):
72 )
73
74 def find_by_value(self, value, wait_time=None):
75 - return self.find_by_xpath(
76 + elem = self.find_by_xpath(
77 '//*[@value="{}"]'.format(value),
78 original_find="value",
79 original_query=value,
80 wait_time=wait_time,
81 )
82 + if elem:
83 + return elem
84 + return self.find_by_xpath('//*[.="%s"]' % value)
85
86 def find_by_text(self, text=None, wait_time=None):
87 xpath_str = _concat_xpath_from_str(text)
88 diff --git a/splinter/driver/zopetestbrowser.py b/splinter/driver/zopetestbrowser.py
89 index adf9a69..fd73c98 100644
90 --- a/splinter/driver/zopetestbrowser.py
91 +++ b/splinter/driver/zopetestbrowser.py
92 @@ -166,9 +166,12 @@ class ZopeTestBrowser(ElementPresentMixIn, DriverAPI):
93 )
94
95 def find_by_value(self, value):
96 - return self.find_by_xpath(
97 + elem = self.find_by_xpath(
98 '//*[@value="%s"]' % value, original_find="value", original_selector=value
99 )
100 + if elem:
101 + return elem
102 + return self.find_by_xpath('//*[.="%s"]' % value)
103
104 def find_by_text(self, text):
105 xpath_str = _concat_xpath_from_str(text)
106 diff --git a/tests/element.py b/tests/element.py
107 index bfcd072..9d55e1a 100644
108 --- a/tests/element.py
109 +++ b/tests/element.py
110 @@ -33,6 +33,12 @@ class ElementTest(object):
111 u'inner <div class="inner-html">inner text</div> html test</div>',
112 )
113
114 + def test_element_html_with_breakline(self):
115 + self.assertEqual(
116 + self.browser.find_by_id("html-property-with-breakline").html,
117 + u'\\n some text here\\n',
118 + )
119 +
120 def test_element_html(self):
121 self.assertEqual(
122 self.browser.find_by_id("html-property").html,
123 diff --git a/tests/find_elements.py b/tests/find_elements.py
124 index cddd0db..27720fa 100644
125 --- a/tests/find_elements.py
126 +++ b/tests/find_elements.py
127 @@ -26,6 +26,11 @@ class FindElementsTest(object):
128 id = self.browser.find_by_id("gender-m")
129 self.assertEqual(id.value, value)
130
131 + def test_finding_by_value_in_btn_elements(self):
132 + value = self.browser.find_by_value("some value").value
133 + btn = self.browser.find_by_id("button-value")
134 + self.assertEqual(btn.value, value)
135 +
136 def test_finding_by_text(self):
137 element = self.browser.find_by_text("Complex")
138 self.assertEqual(element.value, "Complex")
139 diff --git a/tests/static/index.html b/tests/static/index.html
140 index d5125b3..7056cc5 100644
141 --- a/tests/static/index.html
142 +++ b/tests/static/index.html
143 @@ -80,6 +80,7 @@
144 <body>
145 <h1 id="firstheader">Example Header</h1>
146 <h1 id="firstheader">Example Last Header</h1>
147 + <button id="button-value">some value</button>
148 <form action="name" method="GET">
149 <label for="query">Query</label>
150 <input type="text" name="q" />
151 @@ -187,6 +188,7 @@
152 <div class="dragged">no</div>
153 <div class="has-class-first has-class-middle has-class-end"></div>
154 <div id="html-property" class="outer html classes">inner <div class="inner-html">inner text</div> html test</div>
155 + <p id="html-property-with-breakline">\n some text here\n</p>
156 <a id="open-popup" href="javascript:poptastic('/popup')">Open pop-up window</a>
157 <script>
158 function poptastic(url) {
159 diff --git a/tests/test_browser.py b/tests/test_browser.py
160 index c87ee31..06898dc 100644
161 --- a/tests/test_browser.py
162 +++ b/tests/test_browser.py
163 @@ -13,6 +13,10 @@ from imp import reload
164
165 from splinter.exceptions import DriverNotFoundError
166
167 +from selenium.common.exceptions import WebDriverException
168 +
169 +import pytest
170 +
171 from .fake_webapp import EXAMPLE_APP
172
173
174 @@ -57,3 +61,14 @@ class BrowserTest(unittest.TestCase):
175 from splinter import Browser
176
177 Browser("unknown-driver")
178 +
179 +
180 [email protected]('browser_name', ['chrome', 'firefox'])
181 +def test_local_driver_not_present(browser_name):
182 + """When chromedriver/geckodriver are not present on the system."""
183 + from splinter import Browser
184 +
185 + with pytest.raises(WebDriverException) as e:
186 + Browser(browser_name, executable_path='failpath')
187 +
188 + assert "Message: 'failpath' executable needs to be in PATH." in str(e.value)
0 Import-upstream-patch-1.patch
0 #!/usr/bin/make -f
1 # See debhelper(7) (uncomment to enable)
2 # output every command that modifies files on the build system.
3 #export DH_VERBOSE = 1
4
5 export PYBUILD_NAME=splinter
6
7 %:
8 dh $@ --with python3,sphinxdoc --buildsystem=pybuild
9
10
11 override_dh_auto_build:
12 dh_auto_build
13 PYTHONPATH=. http_proxy='127.0.0.1:9' sphinx-build -N -bhtml docs/ build/html
14
15 override_dh_auto_test:
0 3.0 (quilt)
0 extend-diff-ignore = "^[^/]*[.]egg-info/"
0 version=4
1 opts="filenamemangle=s%(?:.*?)?v?(\d[\d.]*)\.tar\.gz%splinter-$1.tar.gz%" \
2 https://github.com/cobrateam/splinter/tags \
3 (?:.*?/)?v?(\d[\d.]*)\.tar\.gz debian uupdate