我在打开所需的URL之前,在chromedriver上安装了Chrome扩展程序。
扩展程序安装后,它会打开一个标签页,显示“感谢您安装”字样。
扩展程序网址:https://chrome.google.com/webstore/detail/buyhatke/jaehkpjddfdgiiefcnhahapilbejohhj?hl=en 我想关闭扩展程序打开的标签页,因为它会不必要地加载数据。
代码片段:
扩展程序网址:https://chrome.google.com/webstore/detail/buyhatke/jaehkpjddfdgiiefcnhahapilbejohhj?hl=en 我想关闭扩展程序打开的标签页,因为它会不必要地加载数据。
代码片段:
from selenium import webdriver
import time
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from bs4 import BeautifulSoup as soup
chrome_options = Options()
chrome_options.add_argument('load-
extension=C:\\Users\\SACHIN\\AppData\\Local\\Google\\Chrome\\User Data\\Default\\Extensions\\jaehkpjddfdgiiefcnhahapilbejohhj\\3.4.141_0')
driver = webdriver.Chrome(chrome_options=chrome_options)
driver.implicitly_wait(30)
driver.get("https://paytm.com/shop/p/samsung-j3-pro-16-gb-black-MOBSAMSUNG-J3-PSTPL5914255C1B4E1C?src=grid&tracker=curated%7C%7Cmobile%20phones%7CCategory%20Grid%7C%2Fg%2Fmobile-accessories%2Fmobiles%2Fsmart-phones%7C66781%7C1%7C")