質問

How to test the ads which displayed on web page. This ads are injected thorugh some plugins. When I record using IDE, it displays the adds on Firefox browser. But when I run the webdriver selenium script from eclips, it does not show any ads, on the webpage of browser launched by selenium..

How to rectify this issue?

役に立ちましたか?

解決

By default, Selenium uses a Firefox profile which is separate from your normal profile when you open the browser manually. So, plugins you've added using your normal profile will not be available to Selenium by default.

So, if ads are injected into a page by a plugin you've installed, that would explain why you aren't seeing them without the plugin when you open FF with Selenium.

You can create a profile to use with Selenium by following these steps:

  1. Make sure all your firefox instance are closed
  2. Click Start>Run
  3. Type firefox.exe -ProfileManager -no-remote
  4. Select “Create Profile”
  5. Click “Next”
  6. Enter new profile name
  7. Select a directory folder to store your new profile
  8. Click “Finish”
  9. Select “Don’t ask at startup”
  10. Click “Start Firefox” and configure your settings
  11. Set Profile back to “default” (to use your normal profile outside Selenium)

And then in Java, set up your driver to use that profile - for example, if you create a profile called "SELENIUM", your java might look like this:

ProfilesIni profile = new ProfilesIni();
FirefoxProfile ffprofile = profile.getProfile("SELENIUM");
driver = new FirefoxDriver(ffprofile);

他のヒント

Testing experience from me: I work for German company, placed in Czech Republic. And there is the page which targets Czech audience. So the AdWords are made for Czech people.

But the company firewall is placed in Germany, which means, that the page thinks I sit in Germany, although I sit in Prague. Which also means that no ads are being displayed to me.

Long story short: Make sure you do not have some another issue like this when running selenium and when running from your browser...

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top