Selenium testing with DoubleClick AD on page - firefox

I am currently writing a selenium test case for a page which has doubleClick ad integrated in header and footer.
Selenium works perfectly fine until it comes to test this page, and test breaks with following issue.
Exception class=[java.lang.IllegalArgumentException]
com.gargoylesoftware.htmlunit.ScriptException: Exception invoking Window.getComputedStyle() with arguments [Text, String]
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:669)
at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:601)
at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:507)
I wonder any one has gone through issue.
Here is my stack
WebDrive : Firefox
HtmlUnit 2.12
Selenium-htmlunit-driver-2.33.0
I think css getting pulled by doubleclick on runtime causing the issue.
Any help in this regard will be helpful.

Related

Error when testingElasticSearch apps via Cypress resulting in results not being populated - "[useElasticsearch] incorrect header check"

We use Elastic Search throughout most of our app, and up until today, we've never had issues with testing those features via Cypress. One feature in our app is a calendar tool that populates a list with appointment dates and times. When accessing this calendar tool manually via Chrome, the list correctly populates without issue. When opening this tool during a Cypress spec, and ONLY during a Cypress spec, the results fail to load. The console spits out an error that just says "[useElasticsearch] incorrect header check" with no other information. In checking the network tab, we can confirm that the ES query is performed and returns results successfully, but the page is not updated with those results.
Note that this is NOT the result of a cy.request(), this error occurs through standard UI navigation. This issue, as I mentioned, ONLY occurs when testing via Cypress. Due to this, we are hesitant to make changes to the backend of the app, since it works perfectly fine in all other scenarios. This has been reproduced on Cypress versions 5.1.0, 6.1.0, 7.1.0, and 8.0.0. This has also been reproduced in Cypress when using the Chrome, Electron, and headless browsers.
Has anybody else encountered this issue?

Script issue in J Meter while recording script using 'BAD BOY' tool

Chrome Settings
HI All - I am new to J meter and i am continuously getting the script error while recording the script using bad boy tool.
I tried with the changing the chrome settings as above:
but still am getting the same script error.
I hope when you normal browse the application then your are not getting the error.
So, if you are recording and getting pop-up but you can proceed further then record your action and suppress the javascript error from Preference>Automatically handle>Javascript Error Dialogs.
You can also disable recording javascript request from Preferences>Recording option. Since, jmeter work on request and response and not GUI level so javascript is not supported. It does not actually parse/execute JavaScript coming with the loaded page.
Also, try the option you have shown to disable script in IE browser and then try with chrome.
Hope this helps.

invalidselector exception + selenium

I have been hit with InvalidSelectorException on a regular basis when i run my selenium web driver test script
My test fails with this InvalidSelector Exception and throws message as :
The xpath expression '//form[#name=somelocator]' cannot be evaluated or does not result in a WebElement
The element locator i use is perfect which return a correct web element when i cross verify it using xpath checker / or with browser console, so no issue with the element locator
I click on some button and then wait for the above xpath locator element to load in the application UI and giving enough waitTilllElementVisible() methods before checking the above locator
I found that many faced this issue, but could not get the concrete reason for this failure.
Selenium asks to visit: http://seleniumhq.org/exceptions/invalid_selector_exception.html for the documentation on this error, but this link looks not up
Reproduced it with selenium 2.45 and 2.46 version with IE11
Please let me know if you knows the reason for this and why it throws invalidSelector exception on browser open with webdriver
I think the problem is the SPACE character in the #name tag. Try "//form[#name='some locator']" or '//form[#name=\'some locator\']'.
#peetya's answer is probably correct and a better answer but I prefer CSS Selectors... they are less error prone if you have the option to not use XPath.
driver.findElement(By.cssSelector("form[name='some locator']"));
CSS Selector reference

Bad request issue with latest version of selenium and firefox

I am working on phpunit-selenium for browser automation with headless Firefox. I updated both selenium and Firefox to latest version. And it started throwing error for me.
“PHPUnit_Extensions_Selenium2TestCase_WebDriverException: Bad request“
Now I googled for this and found that this issue is related to hosts files:
Unable to call FirefoxDriver constructor
https://code.google.com/p/selenium/issues/detail?id=3280
But I cannot update hosts file due to application restrictions. Is there another way to fix this?
Modifying the profile should resolve the issue for you.
Note that this is a Java code fragment, You would have to do something similar with the php API:
profile.setPreference(FirefoxProfile.ALLOWED_HOSTS_PREFERENCE,"set.myhost.com");

Watin - problems with page redirects

I'am trying out Watind. I am having problems with a Login page og the applciation, which automatically redirects to the main page (without any user intervention). It looks like WatiN has troubles with this. Wehn I Invoke:
IE ie = new IE("http://localhost/MyApp/Login.aspx");
The browser opens, it redirects to "Main.aspx", but Watin times out with "Timeout while Internet Explorer state not complete". While debugging, I have found out, that method IEReadyStateIsComplete. When trying to evaluate ie.ReadyState, its is getting the following exception from ie: "The Object has disconnected from its clients".
I am using IE8.
Any ideas how to handles fast redirects?
Matra
It looks like the problem was related to UAC feature of Window 2008 server. I'have restarted VS200 as an Administrator and now it works OK.

Resources