如何使用selenium/phantomjs从javascript代码标记获取数据

9wbgstp7  于 2021-07-09  发布在  Java
关注(0)|答案(0)|浏览(168)

我想从网页上获取信息。当我在浏览器中检查页面源代码时,我会得到简单的html标记,即。

<h3 class="Sans-17px-black-85%-semibold">my_title</h3>

但是,当我运行phantomjs时,我想要的信息以某种方式存储在css(?)中,并由一个图像包围,即(来自driver.getpagesource())

<img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" style="display: none" class="datalet-bpr-guid-572130">
    <code style="display: none" id="bpr-guid-572131">
{ /* many lines of code here ... */ {"$deletedFields":["courses","projects","description","recommendations","honors","entityLocale","organizations","region"],"locationName":"my_city,my_state","entityUrn":"urn:li:fs_position:(ACoAACJOkiYB8DxCiFxrW3EEdFpeIjMlZ2S84ck,997784449)","companyName":"my_company_name","timePeriod":"urn:li:fs_position:(ACoAACJOkiYB8DxCiFxrW3EEdFpeIjMlZ2S84ck,997784449),timePeriod","company":"urn:li:fs_position:(ACoAACJOkiYB8DxCiFxrW3EEdFpeIjMlZ2S84ck,997784449),company","title":"my_title","companyUrn":"urn:li:fs_miniCompany:5163810","$type":"com.linkedin.voyager.identity.profile.Position"} /* more lines of code */
    </code></img>

有没有什么办法可以让你 <code> 变成像浏览器一样的html标记和/或从浏览器内部获取所需的数据 <code> 用 selenium ?

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题