Skip to content

Commit 310365e

Browse files
committed
[py] do not convert tag name to css selector
1 parent 2d9cf16 commit 310365e

4 files changed

Lines changed: 4 additions & 12 deletions

File tree

py/selenium/webdriver/remote/shadowroot.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ def find_element(self, by: By = By.ID, value: str = None):
4747
if by == By.ID:
4848
by = By.CSS_SELECTOR
4949
value = '[id="%s"]' % value
50-
elif by == By.TAG_NAME:
51-
by = By.CSS_SELECTOR
5250
elif by == By.CLASS_NAME:
5351
by = By.CSS_SELECTOR
5452
value = ".%s" % value
@@ -64,8 +62,6 @@ def find_elements(self, by: By = By.ID, value: str = None):
6462
if by == By.ID:
6563
by = By.CSS_SELECTOR
6664
value = '[id="%s"]' % value
67-
elif by == By.TAG_NAME:
68-
by = By.CSS_SELECTOR
6965
elif by == By.CLASS_NAME:
7066
by = By.CSS_SELECTOR
7167
value = ".%s" % value

py/selenium/webdriver/remote/webdriver.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1235,8 +1235,6 @@ def find_element(self, by=By.ID, value=None) -> WebElement:
12351235
if by == By.ID:
12361236
by = By.CSS_SELECTOR
12371237
value = '[id="%s"]' % value
1238-
elif by == By.TAG_NAME:
1239-
by = By.CSS_SELECTOR
12401238
elif by == By.CLASS_NAME:
12411239
by = By.CSS_SELECTOR
12421240
value = ".%s" % value
@@ -1268,8 +1266,6 @@ def find_elements(self, by=By.ID, value=None) -> List[WebElement]:
12681266
if by == By.ID:
12691267
by = By.CSS_SELECTOR
12701268
value = '[id="%s"]' % value
1271-
elif by == By.TAG_NAME:
1272-
by = By.CSS_SELECTOR
12731269
elif by == By.CLASS_NAME:
12741270
by = By.CSS_SELECTOR
12751271
value = ".%s" % value

py/selenium/webdriver/remote/webelement.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -723,8 +723,6 @@ def find_element(self, by=By.ID, value=None):
723723
if by == By.ID:
724724
by = By.CSS_SELECTOR
725725
value = '[id="%s"]' % value
726-
elif by == By.TAG_NAME:
727-
by = By.CSS_SELECTOR
728726
elif by == By.CLASS_NAME:
729727
by = By.CSS_SELECTOR
730728
value = ".%s" % value
@@ -749,8 +747,6 @@ def find_elements(self, by=By.ID, value=None):
749747
if by == By.ID:
750748
by = By.CSS_SELECTOR
751749
value = '[id="%s"]' % value
752-
elif by == By.TAG_NAME:
753-
by = By.CSS_SELECTOR
754750
elif by == By.CLASS_NAME:
755751
by = By.CSS_SELECTOR
756752
value = ".%s" % value

py/test/selenium/webdriver/common/driver_element_finding_tests.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,12 +179,16 @@ def test_should_not_be_able_to_locate_by_tag_name_multiple_elements_that_do_not_
179179
assert len(elements) == 0
180180

181181

182+
@pytest.mark.xfail_firefox(reason='https://github.com/mozilla/geckodriver/issues/2007')
183+
@pytest.mark.xfail_remote(reason='https://github.com/mozilla/geckodriver/issues/2007')
182184
def test_finding_asingle_element_by_empty_tag_name_should_throw(driver, pages):
183185
pages.load("formPage.html")
184186
with pytest.raises(InvalidSelectorException):
185187
driver.find_element(By.TAG_NAME, "")
186188

187189

190+
@pytest.mark.xfail_firefox(reason='https://github.com/mozilla/geckodriver/issues/2007')
191+
@pytest.mark.xfail_remote(reason='https://github.com/mozilla/geckodriver/issues/2007')
188192
def test_finding_multiple_elements_by_empty_tag_name_should_throw(driver, pages):
189193
pages.load("formPage.html")
190194
with pytest.raises(InvalidSelectorException):

0 commit comments

Comments
 (0)