Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AShot().takeScreenshot - org.openqa.selenium.WebDriverException: unknown error: Cannot read property 'offset' of null #117

Open
sasikumar76 opened this issue Jan 4, 2018 · 3 comments

Comments

@sasikumar76
Copy link

sasikumar76 commented Jan 4, 2018

public WebDriver driver;
System.setProperty("webdriver.chrome.driver","/Applications/webdriver/chromedriver");
driver = new ChromeDriver();

i) Screenshot myScreenshot = new AShot().takeScreenshot(driver,multiportal); // in Chrome
throws below error ,

ii) Below code works for me , but assert fails ,have attached the images for reference,

diffimage

Screenshot myScreenshot = new AShot().coordsProvider(new WebDriverCoordsProvider()).takeScreenshot(driver);

But the when i compare 2 screenshots it shows diff. Note i have used same code to generate image and then comparing.

code snippet ,

ImageIO.write(myScreenshot.getImage(),"PNG", new File("/Applications/webdriver/newresult.png"));

	    BufferedImage expectedImage = ImageIO.read(new File("/Applications/webdriver/results.png"));
				
	//	BufferedImage actualImage = myScreenshot.getImage();
		
	    BufferedImage actualImage =     ImageIO.read(newFile("/Applications/webdriver/newresult.png"));
		ImageDiff diff = new ImageDiffer().makeDiff(actualImage, expectedImage);
		BufferedImage diffImage = diff.getMarkedImage();
		File outputfile = new File("/Applications/webdriver/diffImage.png");
		ImageIO.write(diffImage, "PNG", outputfile);
		Assert.assertFalse(diff.hasDiff());
	  
	Error for i) 

org.openqa.selenium.WebDriverException: unknown error: Cannot read property 'offset' of null
(Session info: chrome=63.0.3239.108)
(Driver info: chromedriver=2.34.522932 (4140ab217e1ca1bec0c4b4d1b148f3361eb3a03e),platform=Mac OS X 10.13.1 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 6 milliseconds
Build info: version: '2.52.0', revision: '4c2593c', time: '2016-02-11 19:06:42'
System info: host: 'mine', ip: "mine'', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.13.1', java.version: '1.8.0_77'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEnabled=false, networkConnectionEnabled=false, chrome={chromedriverVersion=2.34.522932 (4140ab217e1ca1bec0c4b4d1b148f3361eb3a03e), userDataDir=/var/folders/j_/f03djz4n2bv3j0swv_xy4glr59r0dp/T/.org.chromium.Chromium.6z7ZUS}, takesHeapSnapshot=true, pageLoadStrategy=normal, databaseEnabled=false, handlesAlerts=true, hasTouchScreen=false, version=63.0.3239.108, platform=MAC, browserConnectionEnabled=false, nativeEvents=true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true, setWindowRect=true, unexpectedAlertBehaviour=}]
Session ID: 28a02b04bf8feb97cafbe312ac022455
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
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:678)
at org.openqa.selenium.remote.RemoteWebDriver.executeScript(RemoteWebDriver.java:577)
at ru.yandex.qatools.ashot.util.JsCoords.findCoordsWithJquery(JsCoords.java:30)
at ru.yandex.qatools.ashot.coordinates.JqueryCoordsProvider.ofElement(JqueryCoordsProvider.java:13)
at ru.yandex.qatools.ashot.coordinates.CoordsProvider.ofElements(CoordsProvider.java:21)
at ru.yandex.qatools.ashot.AShot.takeScreenshot(AShot.java:115)
at ru.yandex.qatools.ashot.AShot.takeScreenshot(AShot.java:132)
at ExampleSel3.openApplication(ExampleSel3.java:86)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:85)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:639)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:816)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1124)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:108)
at org.testng.TestRunner.privateRun(TestRunner.java:774)
at org.testng.TestRunner.run(TestRunner.java:624)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:359)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:354)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:312)
at org.testng.SuiteRunner.run(SuiteRunner.java:261)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1215)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1140)
at org.testng.TestNG.run(TestNG.java:1048)
at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:132)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:236)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:81)

@sasikumar76 sasikumar76 changed the title org.openqa.selenium.WebDriverException: unknown error: Cannot read property 'offset' of null AShot().takeScreenshot - org.openqa.selenium.WebDriverException: unknown error: Cannot read property 'offset' of null Jan 4, 2018
@sasikumar76
Copy link
Author

selenium -3.8.1

ashot - 1.5.2 jar

@musiro77
Copy link

do you have a solution? I know it's long time

@valfirst
Copy link
Collaborator

@musiro77 could you please provide steps to reproduce?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants