Suppose a simple http://mypage.com/ returns the following HTML:

<!DOCTYPE html>
<html>
<head>
    <script type="text/javascript" src="mypage.js"></script>
</head>
<body>
    <h3>Hello World!</h3>
</body>
</html>

So when I issue a Selenium WebDriver.get("http://mypage.com") command, the webdriver will attempt to load my page along with its 'mypage.js'.

My question is: does the WebDriver go through the same "infrastructure" (i.e., the selenium-**webdriver** code) to also download 'mypage.js' or is that already handled separately/innately just by the browser instance that comes up, completely independently of any WebDriver code?

有帮助吗?

解决方案

The Selenium WebDriver controls the browser and does exactly what the browser would do if you were accessing that page. There will be no difference in loading the JavaScript using the WebDriver.

The Selenium website says:

The biggest change in Selenium recently has been the inclusion of the WebDriver API. Driving a browser natively as a user would (...)

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top