比如这个地址:https://y.qq.com/n/ryqq/songD...
使用php-webdriver,获取到的不是渲染后的代码
有办法可以获取到渲染后的页面代码吗?
PS:不是为了抓此站的数据,请勿回复通过api接口获取数据,仅想知道php-webdriver是否能获取到渲染后的代码
//php-webdriver
$host = 'http://localhost:4444/wd/hub';
$capabilities = DesiredCapabilities::chrome();
$driver = RemoteWebDriver::create($host, $capabilities, 5000);
$driver->get("https://y.qq.com/n/ryqq/songDetail/0039MnYb0qxYhV");
$html = $driver->getPageSource();
dump($html);
可以试试这样
getPageSource() 看名称应该是获取页面源代码,也就是和浏览器里右键查看源代码获取到的内容应该是相同的。