document.readyState
loading
complete
navigator.webdriver;
. Вы увидите, что, во-первых, такая переменная там присутствует, а во-вторых, она равна true;
options.add_experimental_option("excludeSwitches", ["enable-automation"])
options.add_argument("--disable-infobars")
from urllib.request import urlopen
import re
from bs4 import BeautifulSoup
Url = 'your_url'
pg = urlopen(Url)
sp = BeautifulSoup(pg)
script_tag = sp.find_all('script')
print(re.search("setVideoHLS\(\'(.*?)\'\)", str(script_tag[индекс элемента(script), где расположена искомая ссылка])).group(1))
from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
firefox_capabilities = DesiredCapabilities.FIREFOX
firefox_capabilities['marionette'] = True
browser = webdriver.Firefox(capabilities = firefox_capabilities)
browser.get('https://google.com')
browser.quit()
display.stop()
binary = FirefoxBinary('/firefox')
heroku run python myScheduledTask.py
heading.execute_script("document.querySelector('div.s-item-title')[0].value='%s'" % h1_text)
Restarting Firefox
Firefox's memory usage may increase if it's left open for long periods of time. A workaround for this is to periodically restart Firefox.
about:memory
selenium-requests
from browsermobproxy import Server
server = Server("path/to/browsermob-proxy")
server.start()
proxy = server.create_proxy()
from selenium import webdriver
profile = webdriver.FirefoxProfile()
profile.set_proxy(proxy.selenium_proxy())
driver = webdriver.Firefox(firefox_profile=profile)
proxy.new_har("гугл")
driver.get("http://www.гугл.рф")
proxy.har
server.stop()
driver.quit()
import os, time
os.environ['TZ'] = 'US/Eastern'
time.tzset()
var config = {
mode: "fixed_servers",
rules: {
singleProxy: {
scheme: "http",
host: "%proxy_host",
port: parseInt(%proxy_port)
},
bypassList: ["foobar.com"]
}
};
chrome.proxy.settings.set({value: config, scope: "regular"}, function() {});
function callbackFn(details) {
return {
authCredentials: {
username: "%username",
password: "%password"
}
};
}
chrome.webRequest.onAuthRequired.addListener(
callbackFn,
{urls: ["<all_urls>"]},
['blocking']
);
{
"version": "1.0.0",
"manifest_version": 2,
"name": "Chrome Proxy",
"permissions": [
"proxy",
"tabs",
"unlimitedStorage",
"storage",
"<all_urls>",
"webRequest",
"webRequestBlocking"
],
"background": {
"scripts": ["background.js"]
},
"minimum_chrome_version":"22.0.0"
}
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
chrome_options = Options()
chrome_options.add_extension("proxy_auth.zip")
driver = webdriver.Chrome(executable_path='chromedriver.exe', chrome_options=chrome_options)
from selenium import webdriver
from selenium.webdriver import DesiredCapabilities
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
binary = FirefoxBinary('C:\..\Firefox.exe')
firefox_capabilities = DesiredCapabilities.FIREFOX
firefox_capabilities['marionette'] = False
dr= webdriver.Firefox(firefox_binary=binary)
dr.get('https://directum.adm.yar.ru/Login.aspx')