我尝试用以下代码加载这个站点的:
import time
from bs4 import BeautifulSoup
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.service import Service
from sys import platform
import os, sys
import xlwings as xw
from selenium.webdriver.support.ui import
def __init__(self):
options = webdriver.ChromeOptions()
options.add_argument("user-data-dir=bot_data")
options.add_argument("--headless") # Runs Chrome in headless mode.
options.add_argument('--no-sandbox') # Bypass OS security model
op
作为第一步,我尝试设置默认下载文件夹。
我试过5种选择,但没有一种有效:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Selenium example for downloading a webpage."""
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.action_chains import ActionChai
我有一个python脚本,它使用selenium来做一些网页点击和抓取。脚本在ubuntu上,在EC2实例上运行。基本代码:
from selenium import webdriver
from bs4 import BeautifulSoup as bs
import datetime
from datetime import datetime as dt
import re
from selenium.webdriver.chrome.options import Options
from selenium.common.exceptions import ElementNotVisib