Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions py/selenium/webdriver/remote/locator_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,16 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
from selenium.webdriver.common.by import By


class LocatorConverter:
def convert(self, by, value):
# Default conversion logic
if by == "id":
return "css selector", f'[id="{value}"]'
elif by == "class name":
return "css selector", f".{value}"
elif by == "name":
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:
return By.CSS_SELECTOR, f'[name="{value}"]'
return by, value
Loading