mirror of https://github.com/vimagick/dockerfiles
Compare commits
2 Commits
dd4a70632e
...
1a6a87191b
Author | SHA1 | Date | |
---|---|---|---|
kevin | 1a6a87191b | ||
kevin | 6215fe7016 |
|
@ -80,6 +80,10 @@ driver.quit()
|
|||
```bash
|
||||
$ docker-compose up -d
|
||||
|
||||
$ crontab -l
|
||||
0 */4 * * * docker restart browserless-browserless-1
|
||||
5 * * * * docker exec browserless-browserless-1 find /tmp -name '.com.google.Chrome.*' -mmin +60 -exec rm -rf {} \;
|
||||
|
||||
$ npm install puppeteer-core
|
||||
$ node screenshot.js
|
||||
$ imgcat google.png
|
||||
|
|
|
@ -38,7 +38,7 @@ baidu-search.py
|
|||
|
||||
```python
|
||||
from selenium import webdriver
|
||||
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
|
||||
from selenium.webdriver.chrome.options import Options
|
||||
from selenium.webdriver.common.proxy import Proxy, ProxyType
|
||||
from selenium.webdriver.common.by import By
|
||||
from selenium.webdriver.support.ui import WebDriverWait
|
||||
|
@ -50,20 +50,20 @@ proxy = Proxy({
|
|||
'sslProxy': '1.2.3.4:8080',
|
||||
})
|
||||
|
||||
capabilities = DesiredCapabilities.CHROME
|
||||
proxy.add_to_capabilities(capabilities)
|
||||
options = Options()
|
||||
options.set_capability('proxy', proxy.to_capabilities())
|
||||
|
||||
driver = webdriver.Remote(
|
||||
command_executor='http://127.0.0.1:4444/wd/hub',
|
||||
desired_capabilities=capabilities
|
||||
options=options
|
||||
)
|
||||
|
||||
driver.get('http://www.baidu.com/')
|
||||
driver.find_element_by_id('kw').send_keys('ip')
|
||||
driver.find_element_by_id('su').click()
|
||||
driver.find_element(By.ID, 'kw').send_keys('ip')
|
||||
driver.find_element(By.ID, 'su').click()
|
||||
|
||||
WebDriverWait(driver, 10).until(
|
||||
EC.presence_of_element_located((By.CLASS_NAME, 'nums_text'))
|
||||
EC.presence_of_element_located((By.ID, 'content_left'))
|
||||
)
|
||||
|
||||
driver.save_screenshot('baidu.png')
|
||||
|
|
|
@ -40,7 +40,7 @@ services:
|
|||
restart: unless-stopped
|
||||
|
||||
video:
|
||||
image: selenium/video:ffmpeg-4.3.1-20231020
|
||||
image: selenium/video:ffmpeg-6.1-20240402
|
||||
volumes:
|
||||
- ./data:/videos
|
||||
ports:
|
||||
|
|
Loading…
Reference in New Issue