如何用Python修改浏览器主页 20
1个回答
展开全部
你可以使用python的webbrowser库来模拟浏览器:
url = '' # Open URL in a new tab, if a browser window is already open.webbrowser.open_new_tab(url + 'doc/') # Open URL in new window, raising the window if possible.webbrowser.open_new(url)
或者使用python的第三方库, selenium
from selenium import webdriverfrom selenium.webdriver.common.keys import Keys browser = webdriver.Firefox() browser.get(')assert 'Yahoo!' in browser.title elem = browser.find_element_by_name('p') # Find the search boxelem.send_keys('seleniumhq' + Keys.RETURN) browser.quit()
url = '' # Open URL in a new tab, if a browser window is already open.webbrowser.open_new_tab(url + 'doc/') # Open URL in new window, raising the window if possible.webbrowser.open_new(url)
或者使用python的第三方库, selenium
from selenium import webdriverfrom selenium.webdriver.common.keys import Keys browser = webdriver.Firefox() browser.get(')assert 'Yahoo!' in browser.title elem = browser.find_element_by_name('p') # Find the search boxelem.send_keys('seleniumhq' + Keys.RETURN) browser.quit()
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询