InternetExplorerDriver getPageSource() is returning a different string than FirefoxDriver

前端 未结 1 471
猫巷女王i
猫巷女王i 2020-12-21 14:57

I am new to Selenium and wonder if someone could point me in the right direction.

I am trying to get the page source of a page, but I notice IE driver returns someth

相关标签:
1条回答
  • 2020-12-21 15:10

    No, that's because the getPageSource method does not return the page source as it would do manually in your browser but returns a text representation of the DOM. Javadoc of getPageSource explains it better:

    java.lang.String getPageSource()

    Get the source of the last loaded page. If the page has been modified after loading (for example, by Javascript) there is no guarantee that the returned text is that of the modified page. Please consult the documentation of the particular driver being used to determine whether the returned text reflects the current state of the page or the text last sent by the web server. The page source returned is a representation of the underlying DOM: do not expect it to be formatted or escaped in the same way as the response sent from the web server. Think of it as an artist's impression.

    0 讨论(0)
提交回复
热议问题