Search code examples
seleniumselenium-webdriverwebdriverqaf

QAF | How to test new age technologies like Angular & React using QAF


We have implemented QAF in our project but finding it difficult with Angular pages. Can we implement ngWebDriver (Protractor) with QAF. Also, I'm reading about FluentSelenium. Any direction to work with new-age technologies


Solution

  • QAF is very advanced framework with lots of features and capability from beginning.

    For Angular/ngWebDriver refer related post and example of custom locator strategy for anngular js.

    Regarding FluentSelenium, you can use as below:

    myScreenShotOnError = ...
    fwd = new FluentWebDriver(new WebDriverTestBase().getDriver(), new CompositeMonitor(new HighlightOnError(ffd), myScreenShotOnError));
    

    However there are many features already exists in qaf that you can use. Here is list of few:

    $("ele.loc").verifyText('glob:*sometext*'); 
    $("ele.loc").assertText('glob:*sometext*');
    
    • With QAF you don't need to worry about element visibility or stale reference element exception.
    • You can add retry in element or driver listener's onfailure method. Ideal example is unexpected or random popup that needs to be dismissed.
        public void onFailure(QAFExtendedWebElement element, CommandTracker commandTracker) {
            //check and close popup if exist
    
            // Actions action = new Actions(element.getWrappedDriver());
            // action.sendKeys(Keys.ESCAPE).build().perform();
    
            closePopUpIfExist(); 
            System.out.println(commandTracker.getCommand() + " element command retring");
    
            if (commandTracker.hasException()
                    && commandTracker.getException() instanceof StaleElementReferenceException) {
                element.setId("-1");
            }
                commandTracker.setRetry(true);
        }