selenium.webdriver.common.by之By

By支持的定位:

  1. CLASS_NAME = 'class name'
  2. CSS_SELECTOR = 'css selector'
  3. ID = 'id'
  4. LINK_TEXT = 'link text'
  5. NAME = 'name'
  6. PARTIAL_LINK_TEXT = 'partial link text'
  7. TAG_NAME = 'tag name'
  8. XPATH = 'xpath'

导入by:

from selenium.webdriver.common.by import By

用法:

#用户名输入框
element=(By.ID,'user_name')

  

posted on 2019-09-02 12:57  Arcy  阅读(1918)  评论(0编辑  收藏  举报

导航