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?

asked Oct 5, 2018 at 17:48
2
  • You mean that part of HTML is missing when you open the page with Selenium? Commented Oct 5, 2018 at 17:51
  • Yes. Updated my question to make this clearer. Commented 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...

answered Oct 5, 2018 at 18:15

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.