Selenium WebDriver下提供许多用来与浏览器、元素、鼠标、键盘、弹框、下拉菜单和列表的交互和设置方法。这些是计算机模拟人工进行自动化测试所必要依赖的方法。下面将用列表的方式总结出常用的API方法:

WebDiver常用方法

Python Selenium 之常用API

WebElement常用方法

Python Selenium 之常用API

鼠标常用方法

  需要特定的ActionChains类并导入,from selenium.webdriver.common.action_chains import ActionChains

Python Selenium 之常用API

键盘常用方法

  需要特定的Keys类并导入, from selenium.webdriver.common.keys import Keys

Python Selenium 之常用API

弹框处理

  需要先切换到弹框上的,alert = driver.seitch_to_alert()

 Python Selenium 之常用API

下拉菜单和列表常用方法

  需要特定的Select类并导入,from selenium.webdriver.support.select import Select

Python Selenium 之常用API

  了解更多API信息,参考:

  https://seleniumhq.github.io/selenium/docs/api/py/api.html

相关文章:

  • 2021-07-01
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-28
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-08-04
  • 2021-06-07
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案