我正在构建一个web爬虫程序,并刚刚将Selenium添加到爬虫程序中,但我意识到,如果不在Selenium之前使用请求,就无法获取http状态代码
我使用Selenium是因为我需要在页面完全加载后获取页面内容
所以现在我的爬虫正在这样做
1. Using request to get http status_code (Counts as 1 reqeust)
1.. Got response code (200,301,400)
2. Using Selenium to get page content (Counts as 1 reqeust)
2.. Got page content from Selenium
问题是,我使用2个请求来获取完整的页面内容,是否存在这样的情况,可能没有使用Selenium,在那里我可以获取页面和响应代码,但只能使用1个请求
简而言之,从
selenium webdriver API
获取status code
目前是不可能的,并且永远不会添加到API中https://github.com/seleniumhq/selenium-google-code-issue-archive/issues/141相关问题 更多 >
编程相关推荐