http://www.amazon.co.jp/gp/bestsellers/gift-cards/ref=zg_bs_nav_0
I am thinking of obtaining the ranking of the products from the above sites.
from selenium import webdriver
from bs4 import BeautifulSoup
driver=webdriver.PhantomJS(executable_path=path)
start_url='http://www.amazon.co.jp/gp/bestsellers/gift-cards/ref=zg_bs_nav_0'
driver.get('start_url')
page_source=driver.page_source
html = BeautifulSoup(page_source, 'html.parser')
print html
As a result of executing this code, I am at a loss because I only get <html>>head>/head>body>>>/html>
.I don't understand the timing of Javascript rendering well, so I would appreciate it if you could explain it to me.
Can't I set driver.get('start_url')
to driver.get(start_url)
?
Also, the HTML tag in the body of the question will not be displayed as it is, so please enclose it with a back quote (`).
(I tried to edit it, but I got an error when the number of characters in the edit was too small...)
© 2024 OneMinuteCode. All rights reserved.