Selenium webdriver Selenium Chromedriver在获取当前url时挂起

Selenium webdriver Selenium Chromedriver在获取当前url时挂起,selenium-webdriver,selenium-chromedriver,google-colaboratory,getcurrenturl,Selenium Webdriver,Selenium Chromedriver,Google Colaboratory,Getcurrenturl,该单元在问题区域运行并暂停,我尝试了driverwait,修改了chrome驱动程序,但似乎没有任何效果。该代码在本地系统中运行得非常好,但在colab中,它只是在当前url上暂停很长时间,没有输出 import sys sys.path.insert(0,'/usr/lib/chromium-browser/chromedriver') from selenium import webdriver from selenium.webdriver.support.ui import WebDr

该单元在问题区域运行并暂停,我尝试了driverwait,修改了chrome驱动程序,但似乎没有任何效果。该代码在本地系统中运行得非常好,但在colab中,它只是在当前url上暂停很长时间,没有输出

import sys
sys.path.insert(0,'/usr/lib/chromium-browser/chromedriver')

from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC

website_to_be_scraped = 'http://gstcouncil.gov.in/cgst-rate-notifications'
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument('--headless')
chrome_options.add_argument('--no-sandbox')
chrome_options.add_argument('--disable-dev-shm-usage')
chrome_options.add_argument('--disable-browser-side-navigation')
browser = webdriver.Chrome('chromedriver',options=chrome_options)

browser.get(website_to_be_scraped)
browser.maximize_window()
main_window = browser.current_window_handle
browser.find_element_by_xpath('//*[@id="block-system-main"]/div/div/div[1]/table/tbody/tr[' + str(i) + ']/td[2]/a').click()
new_tab = browser.window_handles[1]
browser.switch_to.window(new_tab)
# WebDriverWait(browser, 20).until(EC.url_contains("data="))

link_of_notification = browser.current_url  # REGION OF ISSUE
browser.close()
browser.switch_to.window(main_window)browser.close()
browser.switch_to.window(main_window)