You are trying to open a page at a web address. open()will not do this, use urlopen():
from urllib.request import urlopen
url = "your target url here"
soup = bs4.BeautifulSoup(urlopen(url), "html.parser")
Or, use HTTP for people - requestslibrary :
import requests
response = requests.get(url)
soup = bs4.BeautifulSoup(response.content, "html.parser")
Also note that it is strongly recommended that you explicitly specify the parser - I used html.parserin this case, there are other parsers available.
I want to use the same page (same instance)
The usual way to do this is to receive driver.page_sourceand pass it on BeautifulSoupfor further analysis:
from bs4 import BeautifulSoup
from selenium import webdriver
driver = webdriver.Firefox()
driver.get(url)
source = driver.page_source
driver.quit()
soup = BeautifulSoup(source, "html.parser")
source
share