Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7944949
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T00:42:20+00:00 2026-06-04T00:42:20+00:00

Here is my javascript code (in Selenium IDE, with newlines and indentation added for

  • 0

Here is my javascript code (in Selenium IDE, with newlines and indentation added for clarity): storeEval |

var input = window.document.getElementsByTagName('input');
for(var i = 0; i<input.length; i++)  {
    if(window.document.defaultView.getComputedStyle(input[i]).getPropertyValue('background-color') == 'rgb(204, 230, 255)') {
        testResult='passed';
    } else {
        testResult='failed';
    }
} 

| testResult

I need to check color of all inputs. But Selenium Ide stores the result of test only from the last “INPUT”. I’m sure there are errors in the middle of the test. Help please. Sorry for my bad english

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T00:42:22+00:00Added an answer on June 4, 2026 at 12:42 am

    What you should modify:

    • testResult is given a default value
    • a break is added when the test fails in order to stop the for loop
    • discriminate whether you are dealing with a radio, checkbox or other type of input

    Here’s your code updated:

    var input = window.document.getElementsByTagName('input'); 
    testResult = 'passed'; // <-- set a default value for 'testResult'
    for (var i = 0; i < input.length; i++) {
        var bgColor = window.document.defaultView.getComputedStyle(input[i]).getPropertyValue('background-color');
        var inputType = input[i].type;
    
        if (inputType === 'radio' || inputType === 'checkbox') {
            if (bgColor !== 'rgb(r, g, b)') { // change the value to the desired one
                testResult = 'failed';
                break; // <-- this is what you need to break the 'for' loop
            }
        }
        else {
            if (bgColor !== 'rgb(204, 230, 255)') {
                testResult = 'failed';
                break; // <-- this is what you need to break the 'for' loop
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

here is my code.. <script type=text/javascript> function clicker(){ var thediv=document.getElementById('downloadoverlay'); if(thediv.style.display == none){ thediv.style.display
Here is my JavaScript code so far: var linkElement = document.getElementById(BackButton); var loc_array =
Here's my javascript code: <script type=text/javascript> $(document).ready(function() { var currentInput = ''; var currentLabel
Here is my JavaScript code: function Show(output, startX, startY){ var c = document.getElementById(myCanvas); var
Here is javascript code (jquery) for adding a row of images: var tr =
Here's my JavaScript code on my test page. $('#link_share_input').keyup(function () { var link_share_input =
here is javascript code: var test = { h : function (a) {return a;},
Here's the Javascript code: var _a = _a || []; Why it uses ||
Here is some javascript code that I have: var screenWidth = 1280; var screenHeight
Here is the Javascript code, just for test: <script type=text/javascript> function show_confirm() { var

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.