Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Here's what I've done so far.

public void test() {

    String[] list = {};     

    for (int i=0; i<list.length; i++){

        driver.get(baseUrl + "/" + list[i]);    

        boolean text = driver.getPageSource().contains("meta");

        if(!text) {



The problem is, this test returns false. It does not find the meta data.

Any idea why?

share|improve this question
Welcome to SQA, user3249785. Please edit your question to describe what you have done so far. Is this your first time to use JUnit? First time to use Webdriver? – user246 Feb 4 '14 at 16:17

You can match your text, if it is false, you can save the url. Try following:

String[] pages = {"",""};
ArrayList<String> pagesWithoutMeta = new ArrayList<String>();
boolean isMetaPresent= false;
for (int i=0;i<pages.length;i++){
    String text = driver.findElement(By.xpath("//meta[@name='Description']")).getAttribute("content");
    isMetaPresent = text.contains("your text");
    /*Or you can do following:
     *isMetaPresent = driver.getPageSource().contains("your text");*/
        pagesWithoutMeta.add(pages[i]);//If meta is not present add the url in an arraylist, which you can use or print later.

Hope you get the idea.

share|improve this answer
I'll give this a try thank you. – Ben Feb 5 '14 at 17:58
Here's what I ended up using. – Ben Feb 6 '14 at 17:22
See above in the original post. – Ben Feb 6 '14 at 22:54

You can use Apache JMeter for this, it can handle things much faster as it doesn't spawn a real browser and sends HTTP requests (GET in your case) only.

You'll need:

  1. HTTP Request Sampler - to send requests
  2. CSV Data Set Config - to read URLs from file
  3. Response Assertion - to assure that metadata is present in the page source

There is also a WebDriver Sampler for JMeter if you would prefer using a real browser.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.