Announcing fighting-layout-bugs release 0.5

82 views
Skip to first unread message

Michael Tamm

unread,
Aug 24, 2012, 12:16:14 AM8/24/12
to fighting-l...@googlegroups.com
Hi all,

I just released version 0.5 of the Fighting Layout Bugs library.

Here are the changes since version 0.4:

- All CSS animations are paused now and all CSS transitions
  are disabled now, before the analysis runs. (This fixes issue 10)

- Because animation is the main reason for false alarms and
  the AnimationAwareTextDetector did sometimes not discover
  all animated pixels, I decided that if animation should be
  detected for any unknown reason, an AnimationDetectedException
  will be thrown now. This should not happen, because all sources
  of animation are dealed with, but when it happens you will
  no longer get false alarms. (Instead you get the new exception).

- Added method enableDebugMode() to FightingLayoutBugs class.
  If you call this method, more log output is written and
  PNG files of intermediate results will be written to disk,
  which is very helpful to see what's going on.

- DetectInvalidImageUrls will no longer report @font-face src
  URLs as invalid image URLS (This fixes issue 9)

- FLB can now augment RemoteWebDriver instances itself for
  taking screenshots. (This fixes issue 11)

- Updated version of Selenium to 2.25.0

Kind regards,
Michael

prakash

unread,
Aug 16, 2014, 8:06:57 AM8/16/14
to fighting-l...@googlegroups.com, michae...@googlemail.com

Hi GoogleGroup

I am Prakash. While doing some research, found interesting ways to capture few errors on layout using your project.I thank your entire team who is working on layout testing framework.I just want to contribute to your framework by informing you about my issue.

I got stuck with the execution.My code stops by capturing few issues. When it clicks on some link and try to find the lay out issues for the newly loaded webpage,it throws error attached(Layout_Error).Kindly help me in resolving these issues.

Find the below details for your help.

    - My code--Layoutmain.java
    - All logged output.--Attached console output(Layout_Error.txt) 
    - All screenshot files--screenshots.rar
    -Used selenium and other jar files
             1)selenium-server-standalone-2.42.2.jar
              2)fighting-layout-bugs-0.5.jar
              3)commons-httpclient-3.1.jar
    - Which browser (type and version) do you use?--Firefox 30
    - Which Java version do you use?--JDK 1.6
    - Which OS (type and version)do you use?--Windows XP Professional Service Pack 3  and Version 5.1

Regards
Prakash
screenshots.rar
Layoutmain.java
Layout_Error.txt

Michael Tamm

unread,
Aug 18, 2014, 4:31:57 PM8/18/14
to fighting-layout-bugs, prakash
Hi Prakash,

Thank you for the complete error report. I was able to reproduce the problem and it looks
like you found a bug in FLB, which I need to look into ...

But because you have no animation on your web pages, you can use the SimpleTextDetector
instead of the default AnimationAwareTextDetector to circumvent the problem. I have refactored
your Layoutmain class a little bit and now it works on my machine:

public class Layoutmain {

    public static void main(String[] args) {
        File screenshotDir = new File("H:\\Selenium\\screenshots");
        WebDriver driver = new FirefoxDriver();
        try {
            String testPageUrl = "http://newtours.demoaut.com/mercurysignon.php";
            driver.get(testPageUrl);
            analyzePageWithFLB(driver, screenshotDir);
            List<String> urls = scanLinks(driver);
            for (String url : urls) {
                driver.get(url);
                analyzePageWithFLB(driver, screenshotDir);
            }
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            driver.quit();
        }
    }

    private static List<String> scanLinks(WebDriver driver) {
        List<String> urls = new ArrayList<String>();
        List<WebElement> links = driver.findElements(By.tagName("a"));
        for (WebElement a : links) {
            String href = a.getAttribute("href");
            urls.add(href);
        }
        return urls;
    }

    private static void analyzePageWithFLB(WebDriver driver, File screenshotDir) {
        WebPage webPage = new WebPage(driver);
        System.out.println("Analyzing " + webPage.getUrl() + " ...");
        FightingLayoutBugs flb = new FightingLayoutBugs();
        flb.setTextDetector(new SimpleTextDetector()); // <-- this is the important line ;)
        flb.setScreenshotDir(screenshotDir);
        // flb.enableDebugMode();
        final Collection<LayoutBug> layoutBugs = flb.findLayoutBugsIn(webPage);
        if (!layoutBugs.isEmpty()) {
            System.err.println(
                "Found " + layoutBugs.size() + " layout bug(s):\n" +
                    Joiner.on("\n").join(layoutBugs)
            );
        }
    }
}

Kinds regards, Michael

prakash c

unread,
Aug 19, 2014, 2:13:44 PM8/19/14
to Michael Tamm, fighting-layout-bugs
Hi Michael

I am very happy with your solution and it is working fine for me.I just have few doubts over it.We know that findlayoutbugs finds following bugs on a page.But setting SimpleTextDetector does cover all 5 types of bugs on a page?

  • DetectInvalidImageUrls
  • DetectTextNearOrOverlappingHorizontalEdge
  • DetectTextNearOrOverlappingVerticalEdge
  • DetectTextWithTooLowContrast
  • DetectElementsWithInvisibleFocus
Regards
Prakash

Michael Tamm

unread,
Aug 19, 2014, 2:20:25 PM8/19/14
to fighting-layout-bugs, prakash c
You can rest assured that all FLB layout bug detectors work with SimpleTextDetector.
The only reason why I made AnimationAwareTextDector the default is, that the
SimpleTextDetector will not work if a web page contains animation, and might therefore
lead to false alarms.

Kind regard, Michael
Reply all
Reply to author
Forward
0 new messages