selenium.webdriver.common.by之By
By支持的定位:
- CLASS_NAME = 'class name'
- CSS_SELECTOR = 'css selector'
- ID = 'id'
- LINK_TEXT = 'link text'
- NAME = 'name'
- PARTIAL_LINK_TEXT = 'partial link text'
- TAG_NAME = 'tag name'
- XPATH = 'xpath'
导入by:
from selenium.webdriver.common.by import By
用法:
#用户名输入框 element=(By.ID,'user_name')