0


selenium中driver退出,以及基础对象方法整理

退出

with webdriver.Chrome() as driver:

#上下文管理器打开浏览器,不用关闭自动退出

driver.close() :关闭用户当前正在使用的Web浏览器窗口,即WebDriver当前正在访问的窗口。.close() 方法既不需要任何参数,也无任何返回值。

driver.quit() :不同于close(),quit()方法用于关闭程序已打开的所有窗口。该方法也不需要任何参数,也无任何返回值。


基础对象

webdriver对象、浏览器对象、webelement对象

webdriver的方法和操作

driver的方法和操作

element的方法和操作

<class 'selenium.webdriver.remote.webelement.WebElement'>

ActionChains

add_cookie

clear

Android

application_cache

click

BlackBerry

back

**find_element **

**Chrome ****#浏览器(橙色为浏览器兼容性常用方法)**

capabilities

find_element_by_class_name

**ChromeOptions **
#option选项

close

find_element_by_css_selector

Edge

command_executor

find_element_by_id

**Firefox ****#**firefox浏览器

create_options

find_element_by_link_text

FirefoxOptions
**#**firefox option选项

create_web_element

find_element_by_name

FirefoxProfile

current_url

find_element_by_partial_link_text

Ie

current_window_handle

find_element_by_tag_name

IeOptions

delete_all_cookies

find_element_by_xpath

Opera

delete_cookie

find_elements

**PhantomJS **
#无头浏览器

desired_capabilities

find_elements_by_class_name

Proxy

error_handler

find_elements_by_css_selector

Remote

execute

find_elements_by_id

Safari

execute_async_script

find_elements_by_link_text

TouchActions

execute_cdp_cmd

find_elements_by_name

WebKitGTK

execute_script

find_elements_by_partial_link_text

WebKitGTKOptions

file_detector

find_elements_by_tag_name

builtins

file_detector_context

find_elements_by_xpath

cached

**find_element ****#定位元素 **** 1个祖宗方法**

get_attribute

doc

find_element_by_class_name

get_property

file

find_element_by_css_selector

id

loader

find_element_by_id

   is_displayed 
 

name

find_element_by_link_text

is_enabled

package

find_element_by_name

is_selected

path

find_element_by_partial_link_text

location

spec

find_element_by_tag_name

location_once_scrolled_into_view

version

find_element_by_xpath

parent

android

find_elements
#定位一组元素

rect

blackberry

find_elements_by_class_name

screenshot

chrome

find_elements_by_css_selector

screenshot_as_base64

common

find_elements_by_id

screenshot_as_png

edge

find_elements_by_link_text

send_keys

firefox

find_elements_by_name

size

ie

find_elements_by_partial_link_text

submit

opera

find_elements_by_tag_name

tag_name

phantomjs

find_elements_by_xpath

text

remote

forward

value_of_css_property

safari

fullscreen_window

support

get

webkitgtk

get_cookie

get_cookies

get_log

get_network_conditions

get_screenshot_as_base64

get_screenshot_as_file

get_screenshot_as_png

get_window_position

get_window_rect

get_window_size

implicitly_wait

launch_app

log_types

maximize_window

minimize_window

mobile

name

orientation

page_source

quit

refresh

save_screenshot

service

session_id

set_network_conditions

set_page_load_timeout

set_window_position

set_window_rect

set_window_size

start_client

start_session

stop_client

switch_to

switch_to_active_element

switch_to_alert

switch_to_default_content

switch_to_frame

switch_to_window

title

w3c

window_handles

标签: chrome python selenium

本文转载自: https://blog.csdn.net/Lyz_728/article/details/129022529
版权归原作者 Lyz_728 所有, 如有侵权,请联系我们删除。

“selenium中driver退出,以及基础对象方法整理”的评论:

还没有评论