looking to get dynamic website value using selenium and phantomJS

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP


looking to get dynamic website value using selenium and phantomJS



i am trying to get the value for a timer >http://prntscr.com/kcbwd8
on this website > https://www.whenisthenextsteamsale.com/
and hopefully store it in a variable.


import urllib
from bs4 import BeautifulSoup as bs
import time
import requests
from selenium import webdriver
from urllib.request import urlopen, Request
headers = {"User-Agent": "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36
(KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.3"}

browser = webdriver.PhantomJS()
browser.get('https://www.whenisthenextsteamsale.com/')

soup = bs(browser.page_source, "html.parser")
result = soup.find_all("p",{"id":"subTimer"})

for item in result:
print(item.text)

browser.quit()



i have tried using the code above but it returns this error >



C:UsersroberAnaconda3libsite-packagesseleniumwebdriverphantomjswebdriver.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 '
19:59:11



is there any way to fix this ? if not is there another way to get the dynamic values of a site and store them in a variable.



thank you.




1 Answer
1



PhantomJs is no longer being maintained.
https://groups.google.com/forum/m/#!topic/phantomjs/9aI5d-LDuNE



You should use headless chrome / firefox.


options = Options()
options.add_argument("--headless")
driver = webdriver.Firefox(firefox_options=options, executable_path="Path to geckodriver.exe")






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Arduino Mega cannot recieve any sketches, stk500_recv() programmer is not responding

Visual Studio Code: How to configure includePath for better IntelliSense results

C++ virtual function: Base class function is called instead of derived