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

哪个网站专做二手相机wordpress 二次开发 sso

哪个网站专做二手相机,wordpress 二次开发 sso,成品网站w灬源码在线看,东莞市场监督管理局官网为什么要写这个博客呢#xff0c;这个代码前面其实都有#xff0c;就是结束了。明天搞个qq登录#xff0c;这个就结束了。 当然也会更新小说爬取#xff0c;和百度翻译#xff0c;百度小姐姐的爬取#xff0c;的对比爬取。总结嘛#xff01;#xff01;#xff01;加…为什么要写这个博客呢这个代码前面其实都有就是结束了。明天搞个qq登录这个就结束了。 当然也会更新小说爬取和百度翻译百度小姐姐的爬取的对比爬取。总结嘛加油 ajax 有时爬不到东西可能是经过Ajax加载的数据不是原始的HTML文档。 这样我们就要来模拟Ajax请求。 上实例比如说我前几篇的异步社区的爬取。 response requests.get(url,headershearder,paramsparams).text 用的不光有urlheaders还有paramsparams中是对页数等的请求。 得到的是字典样子的数据但是是字符串。 这就要用到json.loads(),来把字符串类型转化为python的字典类型了  -----------------得到字典就是取值了。 同一个网站不用params就不会请求成功。 selenuim---用浏览器实现自动化很强大的反爬工具。 有些网站可能会有JavaScript动态加载数据这种情况下简单的获取初始HTML可能无法获取 这时就是用selenuim来模拟浏览器。 来复习一便selenuim自动化吧-下一篇就是登录自动qq目标 第一篇代码 from selenium import webdriver from selenium.webdriver.common.by import By from selenium.common.exceptions import NoSuchElementException# 创建 WebDriver 对象指明使用chrome浏览器驱动 wd webdriver.Edge()# 调用WebDriver 对象的get方法 可以让浏览器打开指定网址 wd.get(https://www.baidu.com) #寻找(异常的捕获) try:element wd.find_element(By.ID,kw)element.send_keys(通讯)caozuo wd.find_element(By.ID,su)caozuo.click()#点击wd.quit()#退出input(等待回车键结束程序)except NoSuchElementException:print(不存在) 1.导库-最后一个是异常 from selenium import webdriver from selenium.webdriver.common.by import By from selenium.common.exceptions import NoSuchElementException 2.这里try是如果抛出异常就咋咋咋 3. wd.find-element(),caozuo.click()-------------------------很重要 ---------------------二------------------------------- 第二篇代码 from selenium import webdriver from selenium.webdriver.common.by import By from selenium.common.exceptions import NoSuchElementExceptionurl https://cdn2.byhy.net/files/selenium/sample1.html # 创建 WebDriver 对象指明使用chrome浏览器驱动 wd webdriver.Edge()# 调用WebDriver 对象的get方法 可以让浏览器打开指定网址 wd.get(url) #根据ID查找 id_element wd.find_element(By.ID,searchtext) id_element.send_keys(haha) input(jix1) #根据class的名字查找 elements wd.find_elements(By.CLASS_NAME,plant) for i in elements:print(i.text) #根据标签查找 all_elements wd.find_elements(By.TAG_NAME,span) for i in all_elements:print(i.text) #退出 wd.quit() 很简单和第一个差不多就是变成了找一个element变成了找所有elements ----------------------------------三----------------------------------------------- 第三篇代码 import timefrom selenium import webdriver from selenium.webdriver.common.by import By from selenium.common.exceptions import NoSuchElementExceptionurl https://im.qq.com/index/wd webdriver.Edge() wd.implicitly_wait(10)wd.get(url)elements wd.find_element(By.NAME,im.qq.com.login) elements.click() time.sleep(1) element wd.find_element(By.ID,bottom_qlogin) time.sleep(1) element2 wd.find_element(By.ID,switcher_plogin) time.sleep(1) element2.click() time.sleep(2) wd.quit() 这个也没啥就是-----wd.implicitly_wait(10)------因为爬取要时间相当一个等待的代码。 ------------------------------四------------------------------- 第四篇代码 frame窗口转换 import time from selenium import webdriver from selenium.webdriver.common.by import By from selenium.common.exceptions import NoSuchElementExceptionurl https://cdn2.byhy.net/files/selenium/sample2.html wd webdriver.Edge() wd.implicitly_wait(10)wd.get(url) #切换到内frame里面 wd.switch_to.frame(wd.find_element(By.CSS_SELECTOR,[srcsample1.html])) elements wd.find_elements(By.CSS_SELECTOR,.plant) for i in elements:print(i.get_attribute(outerHTML)) #切换到外部 wd.switch_to.default_content() wd.find_element(By.CSS_SELECTOR,#outerbutton) print(wd.find_element(By.CSS_SELECTOR,#outerbutton).get_attribute(outerHTML)) wd.find_element(By.CSS_SELECTOR,#outerbutton).click() time.sleep(2) wd.quit() input(jj)这个很重要加入了CSSCSS也就是选择器很强大。 1.wd.switch_to.frame(wd.find_element(By.CSS_SELECTOR,[srcsample1.html])) 找么有‘ID’或者‘Class’的并且进入frame窗口 2.print(i.get_attribute(outerHTML))——这个将会打印标签在HTML是什么样的打印出来就是什么样的 3.wd.switch_to.default_content()————返回到外部窗口 -------------------------------------------五------------------------------------------- 第五篇代码 浏览器窗口的变化 import time from selenium import webdriver from selenium.webdriver.common.by import Byurl https://cdn2.byhy.net/files/selenium/sample3.html wd webdriver.Edge() wd.implicitly_wait(10)wd.get(url)element wd.find_element(By.CSS_SELECTOR,a)print(element.get_attribute(outerHTML)) element.click() #存储下来 mainWindow wd.current_window_handletime.sleep(5)for handle in wd.window_handles:wd.switch_to.window(handle)print(wd.title)if 必应 in wd.title:breakwd.find_element(By.CSS_SELECTOR,#sb_form_q).send_keys(hahahah) time.sleep(1) wd.find_element(By.CSS_SELECTOR,#search_icon).click()time.sleep(5) #返回窗口 wd.switch_to.window(mainWindow)wd.find_element(By.CSS_SELECTOR,button).click() wd.find_element(By.CSS_SELECTOR,button).click() time.sleep(5)wd.quit()1.mainWindow wd.current_window_handle-这个很有必要就是存储当前窗口以便返回。 2. for handle in wd.window_handles:wd.switch_to.window(handle)print(wd.title)if 必应 in wd.title:break 在目前浏览器窗口找有必应两个字的窗口。并转到 为什么要写这个博客呢这个代码前面其实都有就是结束了。明天搞个qq登录这个就结束了。 当然也会更新小说爬取和百度翻译百度小姐姐的爬取的对比爬取。总结嘛加油
http://www.w-s-a.com/news/718082/

相关文章:

  • 郑州网站建设外包业务wordpress站酷首页
  • 机关门户网站 建设 方案个人怎么申请注册商标
  • 梧州网站建设有哪些九江网站建设优化
  • APP网站建设开发企业发展英文seo招聘
  • 临海市住房和城乡建设规划局网站高校图书馆网站的建设方案
  • 建立门户网站张店易宝网站建设
  • wordpress中英文站点厦门seo顾问屈兴东
  • 邯郸网站建设项目重庆网站备案系统
  • 网站导航容易做黄冈网站建设报价
  • 美橙互联建站网站被截止徐州网站建站
  • 网站班级文化建设视频深圳企业网页设计公司
  • 钦州网站建设公司做宣传网站买什么云服务器
  • 58同城有做网站wordpress怎么改标题和meta
  • 安通建设有限公司网站东莞地铁app
  • 群晖nas做网站滨州教育平台 网站建设
  • 住房城市乡建设部网站装修平台有哪些
  • 小米网站 用什么做的深圳广告公司前十强
  • 勤哲网站开发视频瑞安 网站建设培训
  • 有个蓝色章鱼做标志的网站高端的网站建设怎么做
  • 建站网址导航hao123html网页设计实验总结
  • 西宁市网站建设价格丽水集团网站建设
  • 长宁怎么做网站优化好本机怎么放自己做的网站
  • 诚信网站备案中心网站字体怎么设置
  • 企业网站建设费是无形资产吗佛山网站建设哪个好点
  • 网站建设就业方向国开行网站毕业申请怎么做
  • 创建一个网站的费用wordpress 4.0 安装
  • 会员登录系统网站建设dw软件是做什么用的
  • 手机网站被做跳转长沙网上购物超市
  • 网站建设中网站需求分析设计网站推荐html代码
  • 容易收录的网站台州汇客网站建设