File tree Expand file tree Collapse file tree
py/selenium/webdriver/remote Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -44,11 +44,35 @@ def __repr__(self):
4444 )
4545
4646 def find_element (self , by : By = By .ID , value : str = None ):
47+ if by == By .ID :
48+ by = By .CSS_SELECTOR
49+ value = '[id="%s"]' % value
50+ elif by == By .TAG_NAME :
51+ by = By .CSS_SELECTOR
52+ elif by == By .CLASS_NAME :
53+ by = By .CSS_SELECTOR
54+ value = ".%s" % value
55+ elif by == By .NAME :
56+ by = By .CSS_SELECTOR
57+ value = '[name="%s"]' % value
58+
4759 return self ._execute (
4860 Command .FIND_ELEMENT_FROM_SHADOW_ROOT , {"using" : by , "value" : value }
4961 )["value" ]
5062
5163 def find_elements (self , by : By = By .ID , value : str = None ):
64+ if by == By .ID :
65+ by = By .CSS_SELECTOR
66+ value = '[id="%s"]' % value
67+ elif by == By .TAG_NAME :
68+ by = By .CSS_SELECTOR
69+ elif by == By .CLASS_NAME :
70+ by = By .CSS_SELECTOR
71+ value = ".%s" % value
72+ elif by == By .NAME :
73+ by = By .CSS_SELECTOR
74+ value = '[name="%s"]' % value
75+
5276 return self ._execute (
5377 Command .FIND_ELEMENTS_FROM_SHADOW_ROOT , {"using" : by , "value" : value }
5478 )["value" ]
You can’t perform that action at this time.
0 commit comments