bonfy / leetcode

:sparkles::v::sparkles:leetcode刷题 内附leetcode solution代码自动下载生成器(Leetcode solution auto generator)
554 stars 181 forks source link

mac os 10.12 执行报错 #15

Closed Liloupar closed 6 years ago

Liloupar commented 6 years ago

Selenium support for PhantomJS has been deprecated, please use headless versions of Chrome or Firefox instead warnings.warn('Selenium support for PhantomJS has been deprecated, please use headless ' Traceback (most recent call last): File "leetcode_generate.py", line 523, in do_job(leetcode) File "leetcode_generate.py", line 499, in do_job leetcode.load() File "leetcode_generate.py", line 234, in load self.login() File "leetcode_generate.py", line 190, in login driver.find_element_by_id('id_remember').click() File "/Users/guo/code/leetcode/venv/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 351, in find_element_by_id return self.findelement(by=By.ID, value=id) File "/Users/guo/code/leetcode/venv/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 955, in find_element 'value': value})['value'] File "/Users/guo/code/leetcode/venv/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 312, in execute self.error_handler.check_response(response) File "/Users/guo/code/leetcode/venv/lib/python3.6/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.NoSuchElementException: Message: {"errorMessage":"Unable to find element with id 'id_remember'","request":{"headers":{"Accept":"application/json","Accept-Encoding":"identity","Connection":"close","Content-Length":"92","Content-Type":"application/json;charset=UTF-8","Host":"127.0.0.1:56227","User-Agent":"Python http auth"},"httpVersion":"1.1","method":"POST","post":"{\"using\": \"id\", \"value\": \"id_remember\", \"sessionId\": \"bbbd0580-1908-11e8-8373-630909998a7a\"}","url":"/element","urlParsed":{"anchor":"","query":"","file":"element","directory":"/","path":"/element","relative":"/element","port":"","host":"","password":"","user":"","userInfo":"","authority":"","protocol":"","source":"/element","queryKey":{},"chunks":["element"]},"urlOriginal":"/session/bbbd0580-1908-11e8-8373-630909998a7a/element"}} Screenshot: available via screen

当我把 driver.find_element_by_id('id_remember').click() 移除 并添加 driver.set_window_size(1920, 1080) 后就ok了

bonfy commented 6 years ago

@zohar-soul now it works in macos