admin管理员组文章数量:1123362
I am trying to scrape the website data over at / in order to obtain the data about device battery. However, I am unable to directly get this data using a session on selenium driver, I am trying to first login using my cookie and then open the website in the session.
I get logged in using this way but the data for devices is not available. Moreover, when a device is clicked on, it fetches the data for a while before presenting it which might also be the issue in my case
So, my question is that how can I scrape dynamic websites like this? Answers showing how to do so in python would be very much appreciated. Any other logging-in methods/suggestions which work would also be appreciated.
How I create the session and login:
let service = new chrome.ServiceBuilder('path-to-chrome-driver')
.build();
let options = new chrome.Options();
options.addArguments('headless');
driver = chrome.Driver.createSession(options, service);
await driver.navigate().to('/');
for(cookie: cookies) {
driver.manage().addCookie({name: name, value: value});
}
await driver.navigate().refresh();
await driver.navigate().to('/');
then get the page source by
driver.getPageSource()
I have read this but it is not useful and outdated for my purposes.
I have tried out creating a session on selenium which allows me to login but I cannot get the data I need only from that.
本文标签: selenium webdriverHow do I scrape data from Google Find My DeviceStack Overflow
版权声明:本文标题:selenium webdriver - How do I scrape data from Google Find My Device - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736564708a1944688.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论