Power Apps : Object is Null

While testing an power apps application on Katalon Studio, i am unable to open & select from the dropdown. The object captured through spy web is span_Select an item. We tried by using selectOptionByIndex, selectOptionByLabel, selectOptionByValue. Please let know if more information is required.

Kindly assist.

1 Like

Hi there, and thanks for posting in the Katalon community! :hugs:

To help you faster, please review our guide on Spy Web Utitliy here: Spy Web utility in Katalon Studio | Katalon Docs. Double-checking the steps and configurations might resolve the issue.

If the doc doesn’t help, feel free to provide more details, and a community member will assist you soon.

Thanks for being a part of our community!
Best,
Vu Le

The selectOptionBy*keywords of Katalon Studio is designed to locate <select>....<option>... elements in a web page, like

img

On the other hand, your web page has no <select> ... <option>... elements.

Therefore selectOptionBy* keywords do not work for your target web page at all.

You shared a screenshot of a part of HTML of your target web page:

This indicates that the page is highly-javascript driven. It is not a good-old-classical HTML that the Spy tool assumes.

The Spy Web utility of Katalon Studio does not understand the HTML like this. I guess Katalon Studio is not a suitable tool to test Power Apps.

You should choose a right tool for your job.

By searching Google with key “Power Apps automated test”, I found a blog by Microsoft:

where they describe how to build End-to-end tests for Power Apps using their “Test Studio” which is built-in the Power Apps authoring environment. This article is dated January 2020, which is 5 years old. I guess that Microsoft has done much more up until today.

Hi @alok.moramkar,

How about creating the script based on user experience, rather than using reserved functions like selectOptionByIndex, selectOptionByLabel, or selectOptionByValue?

Instead, you could directly locate the text, for example:

  • Click on the dropdown text.
  • Once the dropdown appears, click on the value text.

Just utilize click method

1 Like

On my project2, none of the drop-downs are <select> tags. Unfortunately for you, you have to create code to capture your “drop-down option”. Below is something that I might try:

import org.openqa.selenium.By as By
import org.openqa.selenium.WebDriver as WebDriver
import org.openqa.selenium.WebElement as WebElement
import com.kms.katalon.core.webui.driver.DriverFactory as DriverFactory

WebDriver driver = DriverFactory.getWebDriver();

strLevel = '...'  // e.g. 1000

List<WebElement> templateLabel = driver.findElements(By.xpath('id("powerapps-flyout-react-combobox-view-7")//ul//li/div/span'));

WebUI.comment("found ${templateLabel.size()}")

for (int cnt = 0; cnt < templateLabel.size(); cnt++) {
    if (templateLabel.get(cnt).getText() == strLevel) {
        templateLabel.get(cnt).click()
        break;
    }
}

Now the example you show above is for just 4 options in this drop-down, I believe. However, if your drop-down has more options, like maybe 8 or more, then you may have to involve a slider component to move to “see” the lower options and it gets a bit more convoluted with maybe a “while” loop and a “scrollAmount” value.

Try locating your parent elements. then you can start accessing its element including dropdown and it’s values