Skip to content

Commit 9b54ed8

Browse files
authored
Merge branch 'trunk' into network
2 parents 618c532 + 0c0d458 commit 9b54ed8

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

py/selenium/webdriver/remote/locator_converter.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,16 @@
1414
# KIND, either express or implied. See the License for the
1515
# specific language governing permissions and limitations
1616
# under the License.
17+
from selenium.webdriver.common.by import By
1718

1819

1920
class LocatorConverter:
2021
def convert(self, by, value):
2122
# Default conversion logic
22-
if by == "id":
23-
return "css selector", f'[id="{value}"]'
24-
elif by == "class name":
25-
return "css selector", f".{value}"
26-
elif by == "name":
27-
return "css selector", f'[name="{value}"]'
23+
if by == By.ID:
24+
return By.CSS_SELECTOR, f'[id="{value}"]'
25+
elif by == By.CLASS_NAME:
26+
return By.CSS_SELECTOR, f".{value}"
27+
elif by == By.NAME:
28+
return By.CSS_SELECTOR, f'[name="{value}"]'
2829
return by, value

0 commit comments

Comments
 (0)