selenium4 The type MobileBy is deprecated
时间: 2024-03-12 22:45:27 浏览: 80
Yes, the type MobileBy is deprecated in Selenium 4. Instead, you should use the new type called By. Here is an example of how to use it:
```python
from selenium.webdriver.common.by import By
# Example of using By with mobile locator strategy
element = driver.find_element(By.XPATH, '//android.widget.TextView[@text="Some text"]')
```
In this example, we are using the XPATH locator strategy in the context of a mobile app. You can use other locator strategies like ID, CSS_SELECTOR, etc. by replacing the first argument in the find_element method.
阅读全文