#--coding=utf8 from selenium import webdriver; import os; import time; import json; from selenium.webdriver.common.keys import Keys; url='http://www.baidu.com'; chrome_driver = os.path.abspath(r"D:\Anaconda2\chromedriver.exe") os.environ["webdriver.chrome.driver"] = chrome_driver driver = webdriver.Chrome(chrome_driver); driver.get(url); driver.find_element_by_id('kw').send_keys('python'+Keys.ENTER) xpath="//div[@class='s_tab']/a[1]"; driver.find_element_by_xpath(xpath).click(); driver.switch_to_window(driver.window_handles[-1]) xpath="//div[@class='s_tab']/a[2]"; driver.find_element_by_xpath(xpath).click();
php selenium测试百度输入和跳转
猜你喜欢
转载自blog.csdn.net/xxq929604980/article/details/65515176
今日推荐
周排行