Automate Adobe PDF web forms (XFA) using selenium web driver - selenium-webdriver

How to automate Adobe PDF web forms (XFA) using selenium web driver ? How to inspect elements in order to input text or click submit button in PDF forms ? These pdf forms are only supported by IE and no other browsers

Selenium Webdriver can only perform operations on DOM.
Can you right click on the form and see if view source option is coming?If not,then i don't think you can input anything on your Adobe PDF using Selenium Webdriver.

You can't automate PDF file but yes you can verify any text any content in PDF file. You can try below code if it met your requirement
Try below code:-
public void ReadPDF() throws Exception {
URL TestURL = new URL("http://www.axmag.com/download/pdfurl-guide.pdf");
BufferedInputStream TestFile = new BufferedInputStream(TestURL.openStream());
PDFParser TestPDF = new PDFParser(TestFile);
TestPDF.parse();
String TestText = new PDFTextStripper().getText(TestPDF.getPDDocument());
Assert.assertTrue(TestText.contains("Open the setting.xml, you can see it is like this"));
}
Download libraries :- https://pdfbox.apache.org/index.html
Hope it will help you :)

Related

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

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?

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/

Open Chrome (or Firefox, Opera etc.), fill login and password using wpf application

I want to run my Chrome(example : System.Diagnostics.Process.Start("http://www.abc123.com");) from WPF application and then fill fields (password and login) automatically, but i DO NOT want to use something like webbrowser control.
Thx for help
You will need to download a WebDriver and the chrome driver.
Include the dlls in your project and you are good to go.
Short exmaple:
IWebDriver driver = new ChromeDriver(#"D:\Download\chromedriver");
driver.Navigate().GoToUrl("http://www.abc123.com");
IWebElement myField = driver.FindElement(By.Id("login"));
myField.SendKeys("username");
For more information see this tutorial.

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/

Resources