We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
By
1 parent f5cfd43 commit 0c0d458Copy full SHA for 0c0d458
py/selenium/webdriver/remote/locator_converter.py
@@ -14,15 +14,16 @@
14
# KIND, either express or implied. See the License for the
15
# specific language governing permissions and limitations
16
# under the License.
17
+from selenium.webdriver.common.by import By
18
19
20
class LocatorConverter:
21
def convert(self, by, value):
22
# Default conversion logic
- 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}"]'
+ if by == By.ID:
+ return By.CSS_SELECTOR, f'[id="{value}"]'
+ elif by == By.CLASS_NAME:
+ return By.CSS_SELECTOR, f".{value}"
+ elif by == By.NAME:
28
+ return By.CSS_SELECTOR, f'[name="{value}"]'
29
return by, value
0 commit comments