codecamp

selenium2 推荐的引入风格

这一章里面API的定义已经展示了类的绝对位置,不过推荐使用下面引入风格:

from selenium import webdriver

然后你就可以这样使用这个类:

webdriver.Firefox
webdriver.FirefoxProfile
webdriver.Chrome
webdriver.ChromeOptions
webdriver.Ie
webdriver.Opera
webdriver.Phantomjs
webdriver.Remote
webdriver.DesiredCapabilities
webdriver.ActionChains
webdriver.TouchActions
webdriver.Proxy

特殊的键盘类(​Keys​)可以这样引入:

from selenium.webdriver.common.keys import Keys

引入​exception​类(把​TheNameOfTheExceptionClass​替换为你真正需要的类名):

from selenium.common.exceptions import [TheNameOfTheExceptionClass]


预期条件支持
selenium2 API的常规使用
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定