Reputation: 200
My test case is clicking a link which opens pdf in the same browser session. It works fine on chrome but IE and firefox gives unknown error. I am using Protractor 2.4.0 w/ jasmine2.
Here is the log from my local selenium server:
16:08:50.090 WARN - Exception thrown
org.openqa.selenium.WebDriverException: Finding elements with css selector == embed[type='application/pdf']returned an unexpected error (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 10.24 seconds
Build info: version: '2.48.2', revision: '41bccdd', time: '2015-10-09 19:59:12'
System info: host: 'nds3370469', ip: '139.172.114.141', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.8.0_71'
Driver info: org.openqa.selenium.ie.InternetExplorerDriver
Capabilities [{browserAttachTimeout=0, enablePersistentHover=true, ie.forceCreateProcessApi=false, pageLoadStrategy=normal, ie.usePerProcessProxy=false, ignoreZoomSetting=true, handlesAlerts=true, version=11, platform=WINDOWS, nativeEvents=true, ie.ensureCleanSession=false, elementScrollBehavior=0, ie.browserCommandLineSwitches=, requireWindowFocus=false, browserName=internet explorer, initialBrowserUrl=http://localhost:24244/, takesScreenshot=true, javascriptEnabled=true, ignoreProtectedModeSettings=false, enableElementCacheCleanup=true, cssSelectorsEnabled=true, unexpectedAlertBehaviour=dismiss}]
Session ID: 509639c4-99d3-4369-bf7c-98dfa8dfdce6
*** Element info: {Using=css selector, value=embed[type='application/pdf']}
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:206)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:647)
at org.openqa.selenium.remote.RemoteWebDriver.findElements(RemoteWebDriver.java:378)
at org.openqa.selenium.remote.RemoteWebDriver.findElementsByCssSelector(RemoteWebDriver.java:486)
at org.openqa.selenium.By$ByCssSelector.findElements(By.java:441)
at org.openqa.selenium.remote.RemoteWebDriver.findElements(RemoteWebDriver.java:341)
at sun.reflect.GeneratedMethodAccessor10.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.openqa.selenium.support.events.EventFiringWebDriver$2.invoke(EventFiringWebDriver.java:102)
at com.sun.proxy.$Proxy1.findElements(Unknown Source)
at org.openqa.selenium.support.events.EventFiringWebDriver.findElements(EventFiringWebDriver.java:176)
at org.openqa.selenium.remote.server.handler.FindElements.call(FindElements.java:50)
at org.openqa.selenium.remote.server.handler.FindElements.call(FindElements.java:1)
at java.util.concurrent.FutureTask.run(Unknown Source)
at org.openqa.selenium.remote.server.DefaultSession$1.run(DefaultSession.java:176)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
16:08:50.117 WARN - Exception: Finding elements with css selector == embed[type='application/pdf']returned an unexpected error (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 10.24 seconds
Build info: version: '2.48.2', revision: '41bccdd', time: '2015-10-09 19:59:12'
System info: host: 'nds3370469', ip: '139.172.114.141', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.8.0_71'
Driver info: org.openqa.selenium.ie.InternetExplorerDriver
Capabilities [{browserAttachTimeout=0, enablePersistentHover=true, ie.forceCreateProcessApi=false, pageLoadStrategy=normal, ie.usePerProcessProxy=false, ignoreZoomSetting=true, handlesAlerts=true, version=11, platform=WINDOWS, nativeEvents=true, ie.ensureCleanSession=false, elementScrollBehavior=0, ie.browserCommandLineSwitches=, requireWindowFocus=false, browserName=internet explorer, initialBrowserUrl=http://localhost:24244/, takesScreenshot=true, javascriptEnabled=true, ignoreProtectedModeSettings=false, enableElementCacheCleanup=true, cssSelectorsEnabled=true, unexpectedAlertBehaviour=dismiss}]
Session ID: 509639c4-99d3-4369-bf7c-98dfa8dfdce6
*** Element info: {Using=css selector, value=embed[type='application/pdf']}
<html>
<body style="background-color: rgb(38,38,38); height: 100%; width: 100%; overflow: hidden; margin: 0"><embed width="100%" height="100%" name="plugin" id="plugin" src="https://dummy-url/image?paymentID=0000107050FAKE11%20%201403FAKE82042302014" type="application/pdf" internalinstanceid="16">
</body>
</html>
Upvotes: 1
Views: 310
Reputation: 14289
Are you sure you are waiting enough for these elements to load? It could be that the page is taking longer time to load in IE and firefox?
var EC = protractor.ExpectedConditions;
var link = $('#plugin');
var isClickable = EC.elementToBeClickable(link);
browser.wait(isClickable, 5000); //wait for an element to become clickable
link.click();
Try using id in the selector instead of 'embed[type="application/pdf"]
It could be that IE is little quirky about using /
in the selector. This is just a guess by the way but worth a try.
Upvotes: 1