- Q What are group policies
- Q Differentiate between % ROWTYPE and TYPE RECORD?
- Q What's RequisitePro ?
- Q In an atom the order of filing up of the orbitals is governed by-
- Q Your organization has many databases on many servers, and a large number of users. The network environment is always changing. What would be the best naming method to use? (Choose the best answer.) A. Easy Connect, because it means that you don’t have to maintain tnsnames .ora files. B. Directory naming, because it centralizes the naming information. C. Local naming, because each user can maintain his own configuration files locally. D. External naming, because you can rely on a third-party product to maintain the configuration information.
- Q What does crm stand for?
- Q What’s the best method for video output using media encoder?
- Q How are web parts developed?
- Q Almeria, Merlot, and Waltham Cross are which fruit?
- Q How can you increase the number of columns in a worksheet?
- Q What is the angle between them?
Question
How to verify pdf content using selenium 2.0
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
Answers
I will explain the procedure to verify PDF file content using java webdriver. As some time we need to verify content of web application pdf file, opened in browser. Use below code in your test scripts to get pdf file content.
//get current urlpdf file url
URL url = new URL(driver.getCurrentUrl());
//create buffer reader object
BufferedInputStream fileToParse = new BufferedInputStream(url.openStream());
PDFParser pdfParser = new PDFParser(fileToParse);
pdfParser.parse();
//save pdf text into strong variable
String pdftxt = new PDFTextStripper().getText(pdfParser.getPDDocument());
//close PDFParser object
pdfParser.getPDDocument().close();
After applying above code, you can store all pdf file content into “pdftxt” string variable. Now you can verify string by giving in put. As if you want to verify “Selenium Or Webdiver” text. Use below code.
Assert.assertTrue(pdftxt.contains(“Selenium Or Webdiver”)) Your Comment
//get current urlpdf file url
URL url = new URL(driver.getCurrentUrl());
//create buffer reader object
BufferedInputStream fileToParse = new BufferedInputStream(url.openStream());
PDFParser pdfParser = new PDFParser(fileToParse);
pdfParser.parse();
//save pdf text into strong variable
String pdftxt = new PDFTextStripper().getText(pdfParser.getPDDocument());
//close PDFParser object
pdfParser.getPDDocument().close();
After applying above code, you can store all pdf file content into “pdftxt” string variable. Now you can verify string by giving in put. As if you want to verify “Selenium Or Webdiver” text. Use below code.
Assert.assertTrue(pdftxt.contains(“Selenium Or Webdiver”)) Your Comment
- 0
- 0
- New Answer
- Contributors: *,
More Software Questions..
What is the inputsplit in map reduce software?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
What is software configuration management?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
What Is Java Api For Xml-based Rpc (jax-rpc)?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
How can you implement fine-grained auditing?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
What is IBM’s simple explanation for Big Data’s four critical features?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
What is static synchronized method in JDBC API? Give an example?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
What does the NULLIF function do?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
What happens if a start method is not invoked and the run method is directly invoked?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
Should we override finalize method
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
what is the difference between mysql_fetch_array and mysql_fetch_object?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
How will XML affect my document links?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
Why to use Style Sheets?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
What are Filters in MVC?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
Can you explain Application layer in OSI model?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
How to define new testplan attributes?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
What are the minimum system requirements to run Photoshop? Is it possible to run Photoshop over linux?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
Which oracle package is used to manage the oracle lock management services?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
What is Latch Up? Explain Latch Up with cross section of a CMOS Inverter. How do you avoid Latch Up?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
What is marker interface?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,
What types of partitioning are there for BW?
- 0
- 0 |
- |
- Post Answer |
- Answers ( 1 )
- Tags: Software,