title,body,link,tags,view_count,is_answered,score,answer_count
Appium GUI testing java.lang.ArrayIndexOutOfBoundsException: Coordinate out of bounds,"<p>I have been using this code successfully until I have to screenshot other smaller images within an image. what it does is to screenshot an image using Appium, and get the background color of the image. It's been working brilliantly until I begin to take screenshots of things like buttons and tried to process them to get the color, I run into errors.</p>
<pre><code>public static void checkBackgroundColor(String mobileElement, String saveReadFile, String hexValue) throws IOException {
        MobileElement elem = (MobileElement) getMobileDriver().findElement(By.xpath(mobileElement));
        File scrFile = elem.getScreenshotAs(OutputType.FILE);
        FileUtils.copyFile(scrFile, new File(saveReadFile));
        BufferedImage image = ImageIO.read( new File(saveReadFile));
        org.openqa.selenium.Point point = elem.getCenter();
        int centerx = point.getX();
        int centerY = point.getY();

        // Getting pixel color by position x and y
        int clr=  image.getRGB(centerY,centerx);
        int  r   = (clr &amp; 0x00ff0000) &gt;&gt; 16;
        int  g = (clr &amp; 0x0000ff00) &gt;&gt; 8;
        int  b =  clr &amp; 0x000000ff;

        String hex = String.format(&quot;#%02x%02x%02x&quot;, r, g, b);
//        softAssertion.assertEquals(hex, hexValue);
        Assert.assertEquals(hex, hexValue);
        if (hex.equals(hexValue)){
            System.out.println(&quot;The color matches standard = &quot;+ hex);
            MyLogger.info(&quot;The color matches standard = &quot;+ hex);
        } else {
            System.out.println(&quot;This is the hex value of rgb = &quot;+ hex);
            MyLogger.error(&quot;This is the hex value of rgb = &quot;+ hex);
        }
    }
</code></pre>
<p>This is the error I'm getting</p>
<pre><code>java.lang.ArrayIndexOutOfBoundsException: Coordinate out of bounds!
    at java.desktop/sun.awt.image.ByteInterleavedRaster.getDataElements(ByteInterleavedRaster.java:313)
    at java.desktop/java.awt.image.BufferedImage.getRGB(BufferedImage.java:917)
    at nl.sample.utils.Utils.checkBackgroundColor(Utils.java:335)
    at nl.sample.steps.mobile.onboarding.UIOnboardingSteps.colorBBOverslaan(UIOnboardingSteps.java:141)
    at nl.sample.mobile.FinanceAdditionTest.buttonFontOnboarding(FinanceAdditionTest.java:660)
    at nl.sample.cucumber.steps.FinanceSteps.onboardingButtonFontCheck(FinanceSteps.java:88)
    at ✽.Onboarding button font check(file:///Users/kadeoye/IdeaProjects/project/sample-test-ui/src/test/java/nl/testing/cucumber/feature/CoverPage.feature:46)
</code></pre>
<p>I have tried a couple of solutions on SO but none worked.</p>
",https://stackoverflow.com/questions/70784527/appium-gui-testing-java-lang-arrayindexoutofboundsexception-coordinate-out-of-b,"['image', 'appium', 'coordinates', 'background-color']",58,False,0,1
Finding all the event listeners for an Android element,"<p>I'm facing a problem in Android GUI testing. When using the UIAutomator to get all the elements in a certain GUI, I can not determine whether I can input some contents in an element, or swipe it left or right.</p>
<p>I'm wondering if there is a way like Chrome Dev Tools that assists in finding all the binding events for a certain element in an Android app? Many thanks.</p>
",https://stackoverflow.com/questions/72797621/finding-all-the-event-listeners-for-an-android-element,"['android', 'user-interface', 'testing', 'black-box-testing']",19,False,0,0
Fyne testing: how do I test dialogs?,"<p>I want to make GUI testing, but investigation of <code>test</code> package and sources of <code>fyne</code> disappoints a lot.</p>
<p>Could somebody please tell, is there a way to fill text fields of a created dialog and click 'ok' and 'cancel' buttons to check results?</p>
<p>All docs I saw only suggest to move creating of form fields out to a <code>func</code> and check them out then individually, and, yes, that's an option, but is there a possibility to check it out as a complete dialog?</p>
",https://stackoverflow.com/questions/70949252/fyne-testing-how-do-i-test-dialogs,"['go', 'fyne']",473,True,-1,2
Qt QML Type Combobox Item cannot be accessed in Squish,"<p>I am trying to automate my GUI testing with Squish Qt tool. My Qt application was developed using QML scripts. For my automation, I have to select item in a Combobox(QML Type), this is the code i am using for that.</p>
<pre><code>import squish

squish.startAllication(&quot;My App&quot;)
squish.mouseClick(squish.waitForObjectItem(&quot;QQuickView_1.Settings_1&quot;, &quot;Mode 2&quot;))
</code></pre>
<p>From Squish Manual I found this function to access Combobox item.</p>
<pre><code>waitForObjectItem(objectOrName, itemOrIndex, timeoutMSec);
</code></pre>
<p>Waits until the objectOrName object is accessible (i.e., it exists and is visible and enabled), and contains an item that is identified by the itemOrIndex and that is itself accessible.</p>
<p>But While using this function  I am getting Object not found error.</p>
<p>And I have found &quot;The waitForObjectItem function can now be used with QComboBox (Qt 3) and Q3ComboBox (Qt 4) controls &quot; this from the manual. Here it says that it will have support for QCombobox only.</p>
<p>How we can access QML Type Combo box?</p>
",https://stackoverflow.com/questions/71676473/qt-qml-type-combobox-item-cannot-be-accessed-in-squish,"['python', 'qt', 'qml', 'squish']",423,False,0,1
How to make sure composer version running on github action would same as composer version inside my docker container?,"<p>I'm not really sure how github actions works when running their jobs. Currently i'm facing this condition:</p>
<ul>
<li>I have devilbox docker services that includes specific php version and also has composer with specific version.</li>
<li>Currently i'm working laravel project with TDD and using artisan (php unit and laravel dusk) to do unit testing, integration testing, and browser testing (gui testing) automatically. Because i don't have PHP on my host machine, so artisan tests must be run inside the docker container, right?</li>
</ul>
<p>So now, how to make sure I can run composer build/update, php artisan test also with laravel dusk inside the docker container to make sure the tools version used is based on the tools installed in the docker container?</p>
<p>I want to get to know how to make sure the tools version used in github actions is based on the tools installed in the docker container</p>
",https://stackoverflow.com/questions/74229461/how-to-make-sure-composer-version-running-on-github-action-would-same-as-compose,"['laravel', 'docker', 'github', 'composer-php', 'github-actions']",168,True,0,1
How to monitor connection attempts from a sandboxed application (to avoid supply chain attacks),"<p>We are using a &quot;classical&quot; DevOps process and in our CI/CD we do a lot of testing - also GUI-testing with Selenium.</p>
<p>Our CI/CD is on premise and not reachable from the outside. At the moment we also have to deal with supply chain risks through compromised third party libraries mostly from npm. One of the major risks here is data exfiltration from within the running application. For this the compromised library must be able to reach a command and control server.</p>
<p>What I was thinking, since the application is actually running during the testing phase but kind of sandboxed in the CI/CD, it would be great to monitor all connection attempts from the application and compare it with a whitelist of known addresses.</p>
<p>Using a proxy on the hosting machine is probably not a solution, since I cannot get granular information which application tried which connection if there are running several build processes in parallel.</p>
<p>I took a look at Jenkins and GitLab but could not find a native solution or plugin for this. Tools like netstat seem only to show the established connections but not the attempts. I also read about <a href=""https://www.cyberciti.biz/faq/enable-firewalld-logging-for-denied-packets-on-linux/"" rel=""nofollow noreferrer"">enabling firewalld logging for denied packages</a> but I'm not so deep into networking to figure out if it's possible to reproduce a blocked package to the corresponding build pipeline.</p>
<p>Is there some state of the art approach for this issue? It kind of seems nearby regarding supply chain risks.</p>
",https://stackoverflow.com/questions/73722877/how-to-monitor-connection-attempts-from-a-sandboxed-application-to-avoid-supply,"['web-applications', 'monitoring', 'sandbox']",25,False,0,0
Iterating through class properties and objects in JavaScript,"<p>I'm working with an automated GUI testing software that we write scripts in JavaScript. We write classes for all of our windows in the software. In these classes, we have objects for the individual fields with properties like the object definition according to the IDE, the name of the field, min, max and default values, etc. I have functions to verify the contents of the fields and I'm working on a function to verify that all fields that should be present are there.</p>
<p>The IDE we use, does not actually have the class keyword included with it's javascript so we're using the function keyword to try and create a similar structure.</p>
<p>It all looks something like this:</p>
<pre><code>function Window()
{
    Window.call(this) // We have a class for all windows that contains all of our basic interaction and verification functions.

    // Variables
    this.ob = main.WindowObject;
    this.name = &quot;Window Name&quot;;
    this.primaryTab = [main.PrimaryTabObject];
    this.secondaryTab = [main.SecondaryTabObject];
    
    // Objects
    this.WindowObjects =
    {
        FIELD1_DROPDOWN:
        {
            sObject: main.Field1ComboBox,
            name: &quot;Field 1:&quot;,
            enum: enums.Field1,
            type: this.dropdownType
        },
        FIELD2_TEXTBOX:
        {
            sObject: main.Field2TextBox,
            name: &quot;Field 2:&quot;,
            type: this.textboxType
        },
        FIELD3_DROPDOWN:
        {
            sObject: primary.Field3ComboBox,
            name: &quot;Field 3:&quot;,
            enum: enums.Field3,
            defaultValue: enums.Field3.properties[enums.Field3.DEFAULT].name,
            minValue: 0,
            maxValue: 10,
            makeVisible: this.primaryTab,
            type: this.dropdownType
        },
        FIELD3_TEXTBOX:
        {
            sObject: primary.Field3Edit,
            name: &quot;Field 3:&quot;,
            enum: enums.Field3,
            defaultValue: enums.Field3.properties[enums.Field3.DEFAULT].name,
            minValue: 0,
            maxValue: 10,
            makeVisible: this.primaryTab,
            type: this.textboxType
        },
        WINDOW_LABEL:
        {
            sObject: main.WindowLabel,
            name: this.name + &quot; Label&quot;,
            type: this.labelType
        }
    }
}
</code></pre>
<p>We have a function in our primary Window class called &quot;verifyFieldExists()&quot;.</p>
<pre><code>this.verifyTextBoxDoesExist = function(textbox)
{
    const logMessage = &quot;Verify that &quot; + textbox.name + &quot; &quot; + textbox.type + &quot; exists in the &quot; + this.name +
                        &quot; window.&quot;;
    const result = object.exists(textbox.sObject);
    let resultMessage;
    
    result
        ? resultMessage = &quot;The &quot; + textbox.type + &quot; exists.&quot;
        : resultMessage = &quot;The &quot; + textbox.type + &quot; does not exist.&quot;;

    resultVP(logMessage, resultMessage, result); // This is a function for logging our results.
}
</code></pre>
<p>You can see how this function is designed to take in one of these class &quot;sub-objects&quot; as an argument. Our windows have often 50+ fields in them and even over 100 sometimes. I feel like I should be able to create a method inside the class that loops through these objects to input them into this function, but the ways I've found so far don't seem to fully work and I can't figure out how to put it all together.</p>
<p>The best way I've found so far would look like this:</p>
<pre><code>for (let property in class.WindowObjects)
{
    class.verifyTextBoxDoesExist (`${property}: ${class.WindowObjects[property]}`);
}
</code></pre>
<p>Which gives a fairly useless error.</p>
<p>EDIT: I've done some more research and found that I should be able to use a structure like this:</p>
<pre><code>Object.keys(class.WindowObjects).forEach(e =&gt; class.verifyTextBoxDoesExist(`${class.WindowObjects[e]}`));
</code></pre>
<p>This seems to return what I want, but it seems to be giving an error at a function inbuilt into our IDE. There may not be a good solution here.</p>
",https://stackoverflow.com/questions/70988108/iterating-through-class-properties-and-objects-in-javascript,"['javascript', 'loops', 'class', 'iteration', 'javascript-objects']",56,False,0,0
