Skip to content

Commit 0bf5179

Browse files
authored
Merge pull request #688 from seleniumbase/update-xpath-to-css-converter
Another update to the xpath-to-css converter
2 parents 56cf4aa + f3f801a commit 0bf5179

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

seleniumbase/fixtures/xpath_to_css.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,8 @@ def convert_xpath_to_css(xpath):
172172
if xpath[0] != '"' and xpath[-1] != '"' and xpath.count('"') % 2 == 0:
173173
xpath = _handle_brackets_in_strings(xpath)
174174
xpath = xpath.replace("descendant-or-self::*/", "descORself/")
175+
if len(xpath) > 3:
176+
xpath = xpath[0:3] + xpath[3:].replace('//', '/descORself/')
175177

176178
if " and contains(@" in xpath and xpath.count(" and contains(@") == 1:
177179
spot1 = xpath.find(" and contains(@")
@@ -211,7 +213,9 @@ def convert_xpath_to_css(xpath):
211213
css = css.replace(" descORself > ", ' ')
212214
css = css.replace("/descORself/*", ' ')
213215
css = css.replace("/descORself/", ' ')
216+
css = css.replace("descORself > ", '')
214217
css = css.replace("descORself/", ' ')
218+
css = css.replace("descORself", ' ')
215219
css = css.replace("_STAR_=", "*=")
216220
css = css.replace("]/", "] ")
217221
css = css.replace("] *[", "] > [")

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454

5555
setup(
5656
name='seleniumbase',
57-
version='1.49.6',
57+
version='1.49.7',
5858
description='Web Automation and Test Framework - https://seleniumbase.io',
5959
long_description=long_description,
6060
long_description_content_type='text/markdown',

0 commit comments

Comments
 (0)