一.浏览器驱动 通过不同的浏览器执行脚本. Open Browser Htpp://www.xxx.com chrome 浏览器对应的关键字: firefox FireFox ff internetexplorer Internet Explorer ie googlechrome Google Chrome gc chrome opera Opera phantomjs PhantomJS htmlunit HTMLUnit htmlunitwithjs HTMLUnit with Javas
RIDE面板认识 selenium API 关键字 语法 参数 备注 Open Browser url Chrome 用不同的浏览器打开url,需要下载不同的浏览器驱动,默认火狐 Close Browser 关闭当前浏览器,Close All Browsers,关闭所有浏览器 Maximize Browser Window 全屏打开浏览器 ${width},${height} Get Window Size 获取浏览器高度 Input Text Xpath=//* [@]
# 获取当前的页面窗口 first_handle = brower.current_window_handle handles = brower.window_handles for i in handles: if i != first_handle: brower.close() # 关闭当前窗口 brower.switch_to.window(i) brower.find_element_by_class_name("button1").click() # 点击提交按钮,提交数据
browser.window_handles for i in ugc_url_l: js = 'window.location.href="{}"'.format(i) browser.execute_script(js) time.sleep(random.randint(20, 60)) browser.find_element_by_xpath('/html/body/div/div[2]/div[1]/div/div[2]/span').click() time.sleep(