Skip to content

Commit 9c2a7c8

Browse files
authored
Merge pull request #29 from scivisum/task/RD-37645_remove_usages_of_lxml
[RD-37645] Removed validation of xpaths, and dep lxml
2 parents cde45d5 + 447a2f1 commit 9c2a7c8

File tree

5 files changed

+3
-26
lines changed

5 files changed

+3
-26
lines changed

browserdebuggertools/chrome/interface.py

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22
import logging
33
from base64 import b64decode, b64encode
44

5-
from lxml.etree import XPath, XPathSyntaxError
6-
7-
from browserdebuggertools.exceptions import InvalidXPathError, ResourceNotFoundError
5+
from browserdebuggertools.exceptions import ResourceNotFoundError
86
from browserdebuggertools.sockethandler import SocketHandler
97

108

@@ -196,17 +194,9 @@ def get_iframe_source_content(self, xpath):
196194
197195
:param xpath: following the spec 3.1 https://www.w3.org/TR/xpath-31/
198196
:return: HTML markup
199-
:raises XPathSyntaxError: The given xpath is invalid
200197
:raises IFrameNotFoundError: A matching iframe document could not be found
201198
:raises UnknownError: The socket handler received a message with an unknown error code
202199
"""
203-
204-
try:
205-
XPath(xpath) # Validates the xpath
206-
207-
except XPathSyntaxError:
208-
raise InvalidXPathError("{0} is not a valid xpath".format(xpath))
209-
210200
return self._dom_manager.get_iframe_html(xpath)
211201

212202
def get_page_source(self):

browserdebuggertools/exceptions.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,5 @@ class MaxRetriesException(DevToolsException):
4646
pass
4747

4848

49-
class InvalidXPathError(DevToolsException):
50-
pass
51-
52-
5349
class UnknownError(ProtocolError):
5450
pass

dev_requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,5 @@ requests
22
mock
33
typing
44
jinja2
5-
lxml
65
websocket-client==0.56
76
cherrypy==17.4.2

setup.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,14 @@
55
"requests",
66
"websocket-client",
77
"typing",
8-
"lxml"
98
]
109

1110

1211
PACKAGES = find_packages(include="browserdebuggertools*")
1312

1413
setup(
1514
name="browserdebuggertools",
16-
version="5.2.0",
15+
version="5.3.0",
1716
packages=PACKAGES,
1817
install_requires=requires,
1918
license="GNU General Public License v3",

tests/e2etests/chrome/test_interface.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
from browserdebuggertools.exceptions import (
1111
DevToolsException, DevToolsTimeoutException, JavascriptDialogNotFoundError,
12-
InvalidXPathError, ResourceNotFoundError
12+
ResourceNotFoundError
1313
)
1414
from browserdebuggertools.models import JavascriptDialog
1515
from tests.e2etests.testsite.start import Server as TestSiteServer, env
@@ -584,13 +584,6 @@ def test_node_found_but_its_not_an_iframe(self):
584584
with self.assertRaises(ResourceNotFoundError):
585585
self.devtools_client.get_iframe_source_content("//div")
586586

587-
def test_invalid_xpath(self):
588-
589-
assert isinstance(self, (ChromeInterfaceTest, TestCase))
590-
591-
with self.assertRaises(InvalidXPathError):
592-
self.devtools_client.get_iframe_source_content("@@")
593-
594587

595588
class Test_ChromeInterface_test_get_frame_html_headed(
596589
HeadedChromeInterfaceTest, Test_ChromeInterface_test_get_iframe_source_content, TestCase

0 commit comments

Comments
 (0)