Grab and save SVG File using selenium - C# Selenium chromedriver WinForm - winforms

I am writing WhatsApp tool in C# winform using Selenium ChromeDriver.
I have handled all operations like sending the message, clicking the attachment and all from WhatsApp web using Selenium ChromeDriver.
I want to read the WhatsApp web's QR Code which is in SVG format. I want to read the SVG File and convert and save as image in local.
I could save the QR Code using snapshot, but I don't prefer using this because I have to maintain vertical scroll position to bring full QR Code on screen.
So please help me save svg file image using chromedriver
Thank you.
-Ishrar

I'm not sure of the specific commands in Selenium, but can't you just:
copy the SVG code via Javascript/a Selenium method
then create a new .svg file in Java and save this copied svg code as the contents?

Related

Can we verify image dimension in a PDF by Selenium webdriver?

I have a requirement to verify the image dimension of a PDF, which is getting downloaded and saved to a particular location. I am curious to know that, is there any way we can check the image dimension of a PDF using Selenium WebDriver? Please help.
Selenium WebDriver is for browser automation. If your requirement is to validate pdf files, contents, images in the pdfs etc, I would suggest you to use the below pdf library.
http://www.testautomationguru.com/introducing-pdfutil-to-compare-pdf-files-extract-resources/

Edge Upload File control using Selenium

I am trying to upload a file using Selenium Webdriver on the Edge browser, and yes I have downloaded EdgeDriver and installed the MSI for testing Edge. Clicking on elements on the screen from within the Edge browser works fine. The problem is the upload file control. My code is as follows:
IWebElement fileUploader2 = Browser.Driver.FindElements(By.CssSelector("input[type='file']"))[0];
fileUploader2.SendKeys(FileUtility.FileUploadsDirectory + "\\sample-account_balances.xlsx");
The code above works for Chrome and Firefox, but does not work for Edge. This is a ReactJS web app. I have tried the suggestions below that are similar to my code above and I cannot seem to upload a file using the control programmatically from Selenium Webdriver. There is no error given it just does not click on send text to the file upload control. Nothing is executed:
How to upload file using Selenium Webdriver?
File Control on Edge
DOM Upload Control Edge
Unfortunately this feature has not been added to the edge webdriver yet. I've run into the same problem and have not been able to find a suitable solution yet. One (admitedly not ideal) solution is to use AutoIt to automate the file upload for edge. There are multiple reports of this issue, but here's one of the latest reports showing that its an issue with the edge driver.

Automation using selenium webdriver to test applet that uploads the file

I have to automate the test in an application which uses applet for file uploading. I know selenium can not read the elements inside the applet.
Can you please tell me, how this can be done?
Snapshot of Applet section displayed in WebApp
You can use sikuli to click on upload button and then use autoit to handle file upload dialog box.
Sikuli Home : http://www.sikuli.org/
AutoIt : http://www.toolsqa.com/selenium-webdriver/autoit-selenium-webdriver/

How to handle downloads in web component in codename one

I wrote a sample servlet which can serve by giving an option to download a pdf file. I want to download that pdf file in to my cn1 app through webBrowser component. Later I want to view that pdf in the browser itself. If possible can you share sample example.
Use the Util.downloadToFilesystemAPI giving a path you generate into the app home from the FileSystemStorage class.
Once download is complete you can just use Display.execute with that path.

Aspose PDF viewer

I am using the Aspose PDF tools and have successfully got it to print the pdf which is great, but ideally I want to be able to add a wpf control to display this as well.
I would have assumed that the PdfViewer class would have something, but I can't tell.
So far I have needed to use a different control MoonPdfPanel which is annoying as I would have preferred 1 tool to do both jobs.
Does anyone know of a control I can use to hook into the aspose?
Thanks
We have developed an HTML5 PDF Editor application using Aspose.Pdf for .NET API which you can use in your application as a PDF Viewer as well. You can get the details and complete source code here. You can use the source code to edit the viewer as per your requirement.
P.S. I am working as social media developer at Aspose.
Well, if you are interesting in viewing the PDF file, you may convert the file to HTML and display it using an IFrame in your application. I have developed a sample application which performs different operations including viewing a PDF file in IFrame. Download it and try it at your end. Another option is that you can convert the PDF file to images and display in Imageviewer in your application (Code is available in the above application).
P.S. I am working as social media developer at Aspose.

Resources