12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- from selenium import webdriver
- from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
- import time
- import os
- import urllib.parse
- from selenium.webdriver.support.ui import WebDriverWait
- from selenium.webdriver.common.by import By
- from selenium.webdriver.support import expected_conditions as EC
- import codecs
- import random
- from bs4 import BeautifulSoup
- import requests
- import time
- import rpyc
- import sys
- import docker
- headers = {
- "Authorization": "Bearer " + "t35vhZtWNgvDNWHc3DJh0OKll3mcB9GvC8K2EAkBug2",
- "Content-Type": "application/x-www-form-urlencoded"
- }
- options = webdriver.ChromeOptions()
- options.add_argument("--user-data-dir=C:\\Users\\jared\\AppData\\Local\\Google\\Chrome\\User Data\\Profile 7\\")
-
- driver = webdriver.Chrome(options=options)
- driver.set_window_size(1400,1000)
- driver.get('https://www.linkedin.com/mynetwork/')
- time.sleep(5)
- elmts=driver.find_elements_by_xpath("//ul[@class='artdeco-card mb4 overflow-hidden']//button[contains(@aria-label,'邀請')]")
- for elmt in elmts:
- print(elmt)
- i=random.randint(0,5)
- if i <=2:
- webdriver.ActionChains(driver).move_to_element(elmt).perform()
- webdriver.ActionChains(driver).move_to_element(elmt).click().perform()
- time.sleep(3)
- print(elmts)
- print(len(elmts))
- time.sleep(9999)
|