import sys
sys.path.append(r"/usr/local/lib/python2.7/dist-packages")
from selenium.webdriver.support.ui import WebDriverWait
import time
import argparse
import sys
import itertools
from queue import Queue
import threading
import os
driver = webdriver.PhantomJS()
start_time = time.time()
try:
driver.get("https://nucleus.niituniversity.in")
emailFieldID = ".//*[@id='SchSel_txtUserName']"
passFieldID = ".//*[@id='SchSel_txtPassword']"
loginButtonXPath = ".//*[@id='SchSel_btnLogin']"
emailFieldElement = WebDriverWait(driver, 10).until(lambda driver: driver.find_element_by_xpath(emailFieldID))
passFieldElement = WebDriverWait(driver, 10).until(lambda driver: driver.find_element_by_xpath(passFieldID))
loginButtonElement = WebDriverWait(driver, 10).until(lambda driver: driver.find_element_by_xpath(loginButtonXPath))
emailFieldElement.click()
emailFieldElement.clear()
emailFieldElement.send_keys("Username")
passFieldElement.click()
passFieldElement.clear()
passFieldElement.send_keys("password")
loginButtonElement.click()
print("\n Time Executed - " + str(time.time() - start_time))
driver.save_screenshot('home.png')
os._exit(1)
except:
driver.save_screenshot('error.png')
driver.quit()
urllib.error.URLError:urlopen错误[Errno 111]拒绝连接
我不知道为什么会发生这种情况?我也试过关闭防火墙,但同样的错误也被提出了。任何人都可以帮我解决这个问题吗?