当前位置: 首页 > wzjs >正文

网站仿做单位门户网站建设的请示

网站仿做,单位门户网站建设的请示,佛山宽屏网站建设,wordpress 爱范儿主题Selenium 是一个开源的 Web 应用程序自动化测试框架,主要用于模拟用户操作浏览器,支持功能测试、兼容性测试及管理任务自动化。 1.下载浏览器驱动 google:右上角三个点>设置>关于Chrome>查看版本>下载对应的webdriver 下载地址&#xff1…

Selenium 是一个开源的 Web 应用程序自动化测试框架,主要用于模拟用户操作浏览器,支持功能测试、兼容性测试及管理任务自动化。

1.下载浏览器驱动

google:右上角三个点>设置>关于Chrome>查看版本>下载对应的webdriver

下载地址:Chrome for Testing availability

Edge:右上角三个点>设置>关于Microsoft Edge>查看版本>下载对应的webdriver

下载地址:Microsoft Edge WebDriver |Microsoft Edge 开发人员

2.示例代码

import timefrom selenium import webdriver
from selenium.webdriver.chrome.service import Service as ChromeServiceservice = ChromeService(executable_path=r"chromedriver.exe")
options = webdriver.ChromeOptions()
driver = webdriver.Chrome(service=service, options=options)try:driver.get('https://www.baidu.com/index.htm')time.sleep(5)
except Exception as e:print(e)
finally:driver.quit()

元素定位使用Xpath

find_element(By.XPATH, "xpath_expression")  # xpath_expression使用浏览器F12,复制

扩展应用:

配合F12使用

import time
import pyperclip
import pyautogui
from selenium import webdriver
from selenium.webdriver.chrome.service import Service as ChromeService
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as ECservice = ChromeService(executable_path=r"D:\desktop\se\driver\chromedriver.exe")
options = webdriver.ChromeOptions()
driver = webdriver.Chrome(service=service, options=options)try:driver.get('https://www.baidu.com/index.htm')time.sleep(3)# pyautogui.press('F12')# Ctrl + [ / Ctrl + ]  切换开发者工具面板pyautogui.hotkey('ctrl', 'shift', 'c')   # 'ctrl', 'shift', 'c' :元素检查模式       'ctrl', 'shift', 'j' :控制台(Console)time.sleep(2)for _ in range(3):  # 切换到网络pyautogui.hotkey('ctrl', ']')## WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.ID, "kw")))driver.find_element(By.ID,'kw').send_keys('大熊猫\n')time.sleep(1)pyautogui.hotkey('ctrl', 'f')# 复制文本到剪贴板pyperclip.copy("nicon_10750f3.png")# 粘贴内容pyautogui.hotkey('ctrl', 'v')pyautogui.press('enter')time.sleep(60)
except Exception as e:print(e)
finally:driver.quit()

http://www.dtcms.com/wzjs/786396.html

相关文章:

  • 无形资产 网站建设公司网站的重要性
  • 广东高端网站建设报价做网站是怎么回事
  • ps做登录网站开网店怎么找货源一件代发
  • 百度推广进入后是别的网站 说是服务器问题seo就业指导
  • 电子书网站开发wordpress手机播放
  • 网站建设 zzit6网络媒体设计是做什么的
  • 网站设计 图片免费微信营销系统
  • 百度网站验证方法网站建设平台的分析
  • 应该知道的网站大连 网站制作 外贸
  • 广告做图网站青岛互联网平台公司
  • thinkphp网站模板公司宣传 如何做公司网站
  • 北京专业建设网站价格自己怎么做百度推广
  • 济源网站开发开发一整个网站要多久
  • 肥城网站设计公司二手房网站建设书
  • 新网站如何做免费推广pythons网站开发
  • 网站创建数据库网上推
  • 国外教做蛋糕的网站网站服务器放在哪里好
  • 小工作室做网站打车软件开发
  • 做拍卖网站怎么样瑞安市网站建设
  • 一起做网店网站入驻收费赤峰网站设计
  • 网站开发的岗位网站源码如何安装
  • 怎么设置iis默认网站做药的常用网站有哪些
  • 自己的网站怎么做进销存百度搜索榜
  • 本地建站软件有哪些2016年网站推广方法
  • 网站域名需icp备案什么是网络营销公司
  • 网站建设论文 优帮云互联网的意思
  • 什么程序做的网站没有index页面恩施网页定制
  • 响应 网站建设网站开发中遇到哪些问题
  • 北京网站优化页面加强政务网站建设
  • 做机械设备类网站用什么颜色好windows最新一代