1

I'm using Selenium with Visual Studio 2017 on an ASP.NET MVC application. Driver is ChromeDriver 2.42.01. Everything works, however one of my tests involves clicking a div which is wrapped into an anchor:

<a class="allowed" href="javascript:loadRegistrationPopUp(10031)">
  <div class="selectContentContainer class-time">
    ...
  </div>
</a>

The function is causing an error because it is undefined. Looking at the page source in Chrome, I find that a major part of the Javascript is missing, particularly the line that includes my script bundle where the function is living. If I open the very same page in a regular Chrome instance, I can see:

<script src="/bundles/default?v=3n...pSQ1"></script>

But that script include (together with the Javascript) is missing when running with Selenium.

To make things even stranger: running the same test on another machine does work, the bundle is there. Same version of Chrome.

What could be causing this?

2
  • You mean that part of HTML is missing when you open the page with Selenium?
    – Alexey R.
    Oct 5, 2018 at 17:51
  • Yes. Updated my question to make this clearer.
    – Krumelur
    Oct 5, 2018 at 17:52

1 Answer 1

1

I found the issue and it has absolutely nothing to do with Selenium. There was a check in the code that would exclude the script in case consent is needed (GDPR compliance). The machine where the tests work are using a US based IP address and thus no consent is required. The other machine, where it is failing, had a German IP...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.