PhantomJS can't load correctly web page

后端 未结 1 2040
谎友^
谎友^ 2021-01-27 04:19

I\'m currently trying to scrape a web page with PhantomJS and Selenium (python 2.7.9 on Windows 7) but PhantomJS fail to load correctly the web page. If I use Firefox as webdriv

1条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-27 05:14

    A bit more information about your usecase would have helped to analyze your issue. However, on windows-10 using Selenium v3.141.0 and phantomjs v2.1.1.0 here is the execution result:

    • Code Block:

      from selenium import webdriver
      
      driver = webdriver.PhantomJS(executable_path=r'C:\WebDrivers\phantomjs.exe', service_args=['--ignore-ssl-errors=true', '--ssl-protocol=tslv1.0'])
      driver.set_window_size(1920, 1080)
      driver.get("https://account.booking.com/register?op_token=EgVvYXV0aCJ7ChQ2Wjcyb0hPZDM2Tm43emszcGlyaBIJYXV0aG9yaXplGhpodHRwczovL2FkbWluLmJvb2tpbmcuY29tLyo2eyJwYWdlIjoiL3JlZGlyZWN0LXRvLWpvaW5hcHAtbHA_bGFuZz1pdCZhaWQ9MTE4NzM2MCJ9QgRjb2RlKg4QAToAQgBY5dGK8gVgAQ")
      print(driver.page_source)
      driver.quit()
      
    • Console Output:

      C:\Python\lib\site-packages\selenium\webdriver\phantomjs\webdriver.py:49: UserWarning: 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 '
      
      
      
      
      Booking.com Account
      
      
      
      
      .
      .
      .
      
      
                                       
                    
提交回复
热议问题