CODE:Python 3.8.5 (tags/v3.8.5:580fbb0, Jul 20 2020, 15:43:08) [MSC v.1926 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
»> #Импорт
»> import os
»> from selenium import webdriver
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\python\lib\site-packages\selenium\webdriver\__init__.py", line 18, in <module>
from .firefox.webdriver import WebDriver as Firefox # noqa
File "C:\python\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 29, in <module>
from selenium.webdriver.remote.webdriver import WebDriver as RemoteWebDriver
File "C:\python\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 26, in <module>
from .webelement import WebElement
File "C:\python\lib\site-packages\selenium\webdriver\remote\webelement.py", line 27, in <module>
from selenium.webdriver.common.utils import keys_to_typing
File "C:\python\lib\site-packages\selenium\webdriver\common\utils.py", line 21, in <module>
import socket
File "C:\python\lib\socket.py", line 49, in <module>
import _socket
ImportError: DLL load failed while importing _socket: Параметр задан неверно.
»> ex = r'1366'
»> ey = r'768'
»> exe_path = r'C:/python/webdriver/chromedriver.exe'
»> os.environ["webdriver.chrome.driver"] = exe_path
»> #Запускаем браузер
»> web = webdriver.Chrome(exe_path)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'webdriver' is not defined
»> web.set_window_size(ex, ey)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'web' is not defined
»> Url = r'https://monolife.ru/game/index.html?servernum=2'
»> Time = r'30'
»> #Максимальное время на загрузку страницы
»> web.set_page_load_timeout(Time)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'web' is not defined
»> #Переходим по URL
»> try:
... web.get(Url)
... except TimeoutException as e:
... print('0')
print('1')
... Traceback (most recent call last):
File "<stdin>", line 2, in <module>
NameError: name 'web' is not defined
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 3, in <module>
NameError: name 'TimeoutException' is not defined
(Добавление)
Только почему написано, что фокс, хотя в блоке хром ?(для просмотра ссылки Вам необходимо авторизоваться) |