Boa tarde pessoal,
Estou com problemas para criar um robô. O mesmo esta dando na linha em negrito. Segue abaixo o erro que está aparecendo. Alguma informação. Estou usando o VSCode versão: 1.73.0, Python versão 3.8.0, chromedriver versão 18 (antepenúltima). Segue código e erro abaixo:
Erro mostrado:
Windows PowerShell
Copyright (C) Microsoft Corporation. Todos os direitos reservados.
Experimente a nova plataforma cruzada PowerShell https://aka.ms/pscore6
PS C:\Users\soare\Documents\Estudos\Python\projectCourse> & 'C:\Users\soare\AppData\Local\Programs\Python\Python38\python.exe' 'c:\Users\soare\.vscode\extensions\ms-python.python-2022.16.1\pythonFiles\lib\python\debugpy\adapter/../..\debugpy\launcher' '52080' '--' 'c:\Users\soare\Documents\Estudos\Python\projectCourse\projeto1\roboweb1.py'
Traceback (most recent call last):
File "C:\Users\soare\AppData\Local\Programs\Python\Python38\lib\runpy.py", line 192, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\soare\AppData\Local\Programs\Python\Python38\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "c:\Users\soare\.vscode\extensions\ms-python.python-2022.16.1\pythonFiles\lib\python\debugpy\adapter/../..\debugpy\launcher/../..\debugpy\__main__.py", line 39, in <module>
cli.main()
File "c:\Users\soare\.vscode\extensions\ms-python.python-2022.16.1\pythonFiles\lib\python\debugpy\adapter/../..\debugpy\launcher/../..\debugpy/..\debugpy\server\cli.py", line 430, in main
run()
File "c:\Users\soare\.vscode\extensions\ms-python.python-2022.16.1\pythonFiles\lib\python\debugpy\adapter/../..\debugpy\launcher/../..\debugpy/..\debugpy\server\cli.py", line 284, in run_file
runpy.run_path(target, run_name="__main__")
PS C:\Users\soare\Documents\Estudos\Python\projectCourse> c:; cd 'c:\Users\soare\Documents\Estudos\Python\projectCourse'; & 'C:\Users\soare\AppData\Local\Programs\Python\Python38\python.exe' 'c:\Users\soare\.vscode\extensions\ms-python.python-2022.16.1\pythonFiles\lib\python\debugpy\adapter/../..\debugpy\launcher' '52168' '--' 'c:\Users\soare\Documents\Estudos\Python\projectCourse\projeto1\roboweb1.py'
Traceback (most recent call last):
File "C:\Users\soare\AppData\Local\Programs\Python\Python38\lib\runpy.py", line 192, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\soare\AppData\Local\Programs\Python\Python38\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "c:\Users\soare\.vscode\extensions\ms-python.python-2022.16.1\pythonFiles\lib\python\debugpy\adapter/../..\debugpy\launcher/../..\debugpy\__main__.py", line 39, in <module>
cli.main()
File "c:\Users\soare\.vscode\extensions\ms-python.python-2022.16.1\pythonFiles\lib\python\debugpy\adapter/../..\debugpy\launcher/../..\debugpy/..\debugpy\server\cli.py", line 430, in main
run()
File "c:\Users\soare\.vscode\extensions\ms-python.python-2022.16.1\pythonFiles\lib\python\debugpy\adapter/../..\debugpy\launcher/../..\debugpy/..\debugpy\server\cli.py", line 284, in run_file
runpy.run_path(target, run_name="__main__")
File "c:\Users\soare\.vscode\extensions\ms-python.python-2022.16.1\pythonFiles\lib\python\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_runpy.py", line 320, in run_path
code, fname = _get_code_from_file(run_name, path_name)
File "c:\Users\soare\.vscode\extensions\ms-python.python-2022.16.1\pythonFiles\lib\python\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_runpy.py", line 294, in _get_code_from_file
code = compile(f.read(), fname, 'exec')
File "c:\Users\soare\Documents\Estudos\Python\projectCourse\projeto1\roboweb1.py", line 17
driver = webdriver.Chrome('C:\Users\soare\Documents\Estudos\Python\chromedriver', options=options)
^
SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape
PS C:\Users\soare\Documents\Estudos\Python\projectCourse>
Obsrvação:
O erro está caindo nesta linha
driver = webdriver.Chrome('C:\Users\soare\Documents\Estudos\Python\chromedriver', options=options)
Codigo:
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time
options = webdriver.ChromeOptions()
options.add_argument('--disable-logging')
options.add_argument('--log-level=3')
driver = webdriver.Chrome('C:\Users\soare\Documents\Estudos\Python\chromedriver', options=options)
driver.get("https://registro.br/")
pesquisa = driver.find_elements_by_id('is-avail-field')
pesquisa.clear()
pesquisa.send_keys('roboscompython.com.br')
pesquisa.send_keys(Keys.RETURN)
time.sleep(8)
driver.close()