Closed kathyrollo closed 1 year ago
I'll check it in a few days
I've tested it and I can't reproduce this error.
File was saved to a directory in this line:
File.WriteAllBytes(fileName, sshot);
@Noksa Thanks for looking into it. What was the exact Selenium version you used?
@kathyrollo I used the latest version from nuget. It was 4.1.0
@Noksa Thanks, this was observed in 4.0.1. Will check with the latest version to see if it replicates and update.
Seems like this is the proper place to post this as I'm also having issues with 4.x.
When calling WDSE.ExtensionMethods.TakeScreenshot(this IWebDriver driver, IScreenshotStrategy strategy) I get this exception: System.TypeLoadException: 'Could not load type 'OpenQA.Selenium.Remote.CapabilityType' from assembly 'WebDriver, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null'.'
It looks like CapabilityType was moved to the OpenQA.Selenium namespace
Seems like this is the proper place to post this as I'm also having issues with 4.x.
When calling WDSE.ExtensionMethods.TakeScreenshot(this IWebDriver driver, IScreenshotStrategy strategy) I get this exception: System.TypeLoadException: 'Could not load type 'OpenQA.Selenium.Remote.CapabilityType' from assembly 'WebDriver, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null'.'
It looks like CapabilityType was moved to the OpenQA.Selenium namespace
I would like to report the same issue
Got the same error
System.TypeLoadException: Could not load type 'OpenQA.Selenium.Remote.CapabilityType' from assembly 'WebDriver, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null'. at OpenQA.Selenium.Support.Extensions.WebDriverExtensions.TakeScreenshot(IWebDriver driver) at WDSE.ScreenshotMaker.ScreenshotMaker.MakeScreenshot(IWebDriver driver) at WDSE.Decorators.VerticalCombineDecorator.CombineScreenshots(IWebDriver driver) at WDSE.Decorators.VerticalCombineDecorator.MakeScreenshot(IWebDriver driver) at WDSE.ExtensionMethods.TakeScreenshot(IWebDriver driver, IScreenshotStrategy strategy)
<PackageReference Include="Selenium.WebDriver" Version="4.1.0" />
<PackageReference Include="Noksa.WebDriver.ScreenshotsExtensions" Version="0.1.5.4" />
Got the same error
System.TypeLoadException: Could not load type 'OpenQA.Selenium.Remote.CapabilityType' from assembly 'WebDriver, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null'. at OpenQA.Selenium.Support.Extensions.WebDriverExtensions.TakeScreenshot(IWebDriver driver) at WDSE.ScreenshotMaker.ScreenshotMaker.MakeScreenshot(IWebDriver driver) at WDSE.Decorators.VerticalCombineDecorator.CombineScreenshots(IWebDriver driver) at WDSE.Decorators.VerticalCombineDecorator.MakeScreenshot(IWebDriver driver) at WDSE.ExtensionMethods.TakeScreenshot(IWebDriver driver, IScreenshotStrategy strategy)
<PackageReference Include="Selenium.WebDriver" Version="4.1.0" />
<PackageReference Include="Noksa.WebDriver.ScreenshotsExtensions" Version="0.1.5.4" />
For us a workaround solution was to downgrade Selenium.WebDriver and Selenium.Support to v4.0.0
Can someone share a sample project where it reproduces every time? I would very appreciate because I can't reproduce it.
Can someone share a sample project where it reproduces every time? I would very appreciate because I can't reproduce it.
The reason for failing for me was that I did not have Selenium.Support
in my solution.
And seems like the version from your solution (3.8.0) was used.
Adding <PackageReference Include="Selenium.Support" Version="4.1.0" />
to my solution fixed the issue.
So updating Selenium.WebDriver
and Selenium.Support
versions to 4.1.0
in your solution should probably fix the issue.
Yeah, that's why I wrote this message: https://github.com/Noksa/WebDriver.Screenshots.Extensions/issues/27#issuecomment-983457976
Yea, but to reproduce the issue you can just create an empty project and reference only Selenium.WebDriver 4.1.0 and your NuGet package. That is was you asking for, right?
Can someone share a sample project where it reproduces every time? I would very appreciate because I can't reproduce it.
I still have the same issue after I downgraded from V4.11.x to V3.14.1. I'm not sure where I can add " Adding '<PackageReference Include="Selenium.Support" Version="4.1.0" /'> to my solution fixed the issue. So updating Selenium.WebDriver and Selenium.Support versions to 4.1.0 in your solution should probably fix the issue. "
[updated] I had trouble with the nuget package versions mapping tables while downgrade and upgrade nuget installations. I had to search to understand shatulsky's comments and it helped me solve it.
So I confirmed adding Selenium.Support (with the proper version) fixes the issue.
Here's a scenario
The other fix would be to add a new WDSE version (say 4.0) that has a dependency on 4.x of the Selenium packages - that way it's clear you need a WDSE 4.x if you're using Selenium 4.x. Otherwise people will continue to get the latest WSDE and Selenium.WebDriver packages only and get this error.
@Noksa here's an example
<ItemGroup>
<PackageReference Include="Noksa.WebDriver.ScreenshotsExtensions" Version="0.1.5.4" />
<PackageReference Include="Selenium.WebDriver" Version="4.3.0" />
<PackageReference Include="WebDriverManager" Version="2.14.1" />
</ItemGroup>
using OpenQA.Selenium.Chrome;
using OpenQA.Selenium.Support.Extensions;
using WDSE;
using WDSE.Decorators;
using WDSE.ScreenshotMaker;
using WebDriverManager;
using WebDriverManager.DriverConfigs.Impl;
new DriverManager().SetUpDriver(new ChromeConfig());
var driver = new ChromeDriver();
driver.Navigate().GoToUrl("https://slashdot.org");
// throws
var screenshot = driver.TakeScreenshot(new VerticalCombineDecorator(new ScreenshotMaker()));
Hi @Noksa ,
I confirm it works with the following latest versions (as of this writing):
I'm closing the ticket unless you deem otherwise. Thanks.
No compile error but the same code that used to work with Selenium 3.141.0 no longer saves screenshots after updating to Selenium 4.0.1.