hello!python!

随笔分类 -  selenium

摘要:/** * * @param driver * @param by * @param seconds 等待多少秒 * @return */ public WebElement waitPageOpen(WebDriver driver,By by,long seconds){ WebDriverWa 阅读全文
posted @ 2023-08-24 17:53 你坚持了吗 阅读(4) 评论(0) 推荐(0) 编辑
摘要:参考:https://www.cnblogs.com/LanTianYou/p/5578621.html 阅读全文
posted @ 2018-02-23 10:44 你坚持了吗 阅读(359) 评论(0) 推荐(0) 编辑
摘要:如果有两个平级的frame,跳进一个以后操作完成再操作第二个,这种情况要先跳出来,再跳进另外一个frame跳出语句:browser.switch_to_default_content()#coding:utf-8from selenium import webdriverimport timeurl... 阅读全文
posted @ 2014-07-11 16:47 你坚持了吗 阅读(1973) 评论(0) 推荐(0) 编辑
摘要:#coding:gbkfrom selenium import webdriverfrom selenium.webdriver.common.keys import Keysfrom selenium.webdriver.support.ui import WebDriverWaitimport timedriver=webdriver.Chrome()driver.get('http://www.baidu.com')driver.find_element_by_id('lb').click()#driver.find_element_by_id(' 阅读全文
posted @ 2013-09-10 17:30 你坚持了吗 阅读(2961) 评论(0) 推荐(0) 编辑
摘要:selenium-webdriver(python)--cookie处理driver.get_cookies()获得cookie信息add_cookie(cookie_dict)向cookie添加会话信息delete_cookie(name)删除特定(部分)的cookiedelete_all_cookies()删除所有cookie通过webdriver操作cookie是一件非常有意思的事儿,有时候我们需要了解浏览器中是否存在了某个cookie信息,webdriver可以帮助我们读取、添加,删除cookie信息。打印cookie信息#coding=utf-8fromseleniumimportw 阅读全文
posted @ 2013-09-09 21:25 你坚持了吗 阅读(1303) 评论(0) 推荐(0) 编辑
摘要:1.通过类class获取 比如如下代码 This heading is very important. This paragraph is very important. This paragraph is a very important ... 阅读全文
posted @ 2013-09-09 18:33 你坚持了吗 阅读(34703) 评论(4) 推荐(0) 编辑
摘要:from selenium import webdriverfrom selenium.webdriver.common.keys import Keysimport timedriver=webdriver.Chrome()driver.get('http://www.baidu.com')driver.find_element_by_id('lb').click()#driver.find_element_by_id('TANGRAM__PSP_10__unameLoginLink').click()time.sleep(3)driver.f 阅读全文
posted @ 2013-09-09 16:13 你坚持了吗 阅读(15090) 评论(0) 推荐(0) 编辑
摘要:先列出selenium所有方法,然后挨个使用!说明add_cookieapplication_cachebackcapabilitiesclosecommand_executorcreate_web_elementcurrent_urlcurrent_window_handledelete_all_cookiesdelete_cookiedesired_capabilitieserror_handlerexecuteexecute_async_scriptexecute_scriptfind_elementfind_element_by_class_namefind_element_by_cs 阅读全文
posted @ 2013-09-03 11:04 你坚持了吗 阅读(1425) 评论(0) 推荐(0) 编辑
摘要:易迅的登录方法,因为页面有很多iframe的内置框架,需要先逐级定位到登录元素所在的iframe才行使用方法switch_to_frame('id-name')from selenium import webdriverfrom selenium.webdriver.common.keys import Keysdriver = webdriver.Chrome()driver.get("http://item.yixun.com/item-712354.html?YTAG=3.21012000")driver.find_element_by_id(&quo 阅读全文
posted @ 2013-09-03 10:53 你坚持了吗 阅读(7020) 评论(0) 推荐(0) 编辑
摘要:浏览器页面跳转方法记录:from selenium import webdriverimport timebrowser = webdriver.Chrome()first_url='http://www.baidu.com'browser.find_element_by_xpath('//div/div/div/ul/li[1]/strong/a').click()browser.switch_to_window(browser.window_handles[0])browser.title #第一个页面browser.switch_to_window(bro 阅读全文
posted @ 2013-08-29 18:15 你坚持了吗 阅读(20352) 评论(1) 推荐(1) 编辑

hello!python!