|
@@ -86,7 +86,7 @@ if __name__ == "__main__":
|
|
|
options.add_argument('--headless')
|
|
|
options.add_argument('--disable-gpu')
|
|
|
options.add_argument('--no-sandbox')
|
|
|
- options.add_argument('--user-agent=Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.5993.70 Safari/537.36')
|
|
|
+ # options.add_argument('--user-agent=Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.5993.70 Safari/537.36')
|
|
|
options.add_argument(" window-size=1920,1080")
|
|
|
# options.add_argument(" window-size=1920,1080")
|
|
|
s = Service(executable_path='/home/code/python/meeting_probabilities/chromedriver')
|
|
@@ -103,6 +103,8 @@ if __name__ == "__main__":
|
|
|
driver.get(
|
|
|
'https://www.cmegroup.com/markets/interest-rates/cme-fedwatch-tool.html?redirect=/trading/interest-rates/countdown-to-fomc.html')
|
|
|
sleep(2)
|
|
|
+ agent = driver.execute_script("return navigator.userAgent")
|
|
|
+ print(agent)
|
|
|
text = driver.find_element(By.XPATH, '//*[@id="page_default_sections"]/div/div/div/div/div/p[1]/span')
|
|
|
print("网页中段,文本内容:")
|
|
|
print(text.text)
|