Ask a Question

The script runs perfectly if executed alone, but fails when it is joined together

SOLVED
prekar
Occasional Contributor

The script runs perfectly if executed alone, but fails when it is joined together

Hi All,

I have wriiten a script to select colors/options for various dropdown fields as below. When i execute each field separately, it opens the dropdown box and selects the required option but when executed together, it fails after the first dropdown color select and the error message says "Out of the window bounds". Any idea why???

function otherBranchdet(){
page = browser.Page("*");
//Solid Fill Color
page.FindElement("#Form_EditForm_SolidFillID_chosen > .chosen-single").Click();
page.FindElement("//li[contains(text(), 'ABC- Solid fill ( #823A22 )')]").Click();
//Light Tint Fill color
page.FindElement("#Form_EditForm_LightTintFillID_chosen > .chosen-single").Click();
page.FindElement("//li[contains(text(), 'ABC- Light tint fill ( #F3EBE9 )')]").Click();
//Darker Tint Fill color
page.FindElement("#Form_EditForm_DarkerTintFillID_chosen > .chosen-single").Click();
page.FindElement("//li[contains(text(), 'ABC- Darker tint fill ( #DAC4BD )')]").Click();
//Lines on Light Tint Fill color
page.FindElement("#Form_EditForm_LinesOnLightTintFillID_chosen > .chosen-single").Click();
page.FindElement("//li[contains(text(), 'ABC- Light line tint fill ( #DAC4BD )')]").Click();
//Lines on Darker Tint Fill color
page.FindElement("#Form_EditForm_LinesOnDarkerTintFillID_chosen > .chosen-single").Click();
page.FindElement("//li[contains(text(), 'ABC- Dark line tint fill ( #C19D91 )')]").Click();
//Header Search Input fill color
page.FindElement("#Form_EditForm_SearchInputFillID_chosen > .chosen-single").Click();
page.FindElement("//li[contains(text(), 'ABC- Light line tint fill ( #DAC4BD )')]").Click();
}

 

1 ACCEPTED SOLUTION

Accepted Solutions
prekar
Occasional Contributor

Re: The script runs perfectly if executed alone, but fails when it is joined together

Hi All,

So i found out the root cause of the issue. Since all the drop down fields have same values, when it selects a value from the first drop down field, it stores that field's dom values or bounday values and though it opens the second drop down, it searches for the values in first drop down and since it couldn't find it, the test gave me out of the bounds error.

Therefore, I made my xpath element more absolute(teels it in which dropdown, it should look for the values) and it resolved the issue.

Hope it helps.

View solution in original post

3 REPLIES 3
mattb
Staff

Re: The script runs perfectly if executed alone, but fails when it is joined together

Hello,

I would recommend adding a delay before the clicks, even 300-500 ms makes a difference for some difficult drop downs. 

Also I would check to make sure where the click is occurring, make sure it is set to click at (-1, -1) which would click the middle of the button

prekar
Occasional Contributor

Re: The script runs perfectly if executed alone, but fails when it is joined together

Thanks for the idea.. But that doesn't work as well. Works fine for the first set of clicks and getting the same error for second set of clicks.

prekar
Occasional Contributor

Re: The script runs perfectly if executed alone, but fails when it is joined together

Hi All,

So i found out the root cause of the issue. Since all the drop down fields have same values, when it selects a value from the first drop down field, it stores that field's dom values or bounday values and though it opens the second drop down, it searches for the values in first drop down and since it couldn't find it, the test gave me out of the bounds error.

Therefore, I made my xpath element more absolute(teels it in which dropdown, it should look for the values) and it resolved the issue.

Hope it helps.

View solution in original post

cancel
Showing results for 
Search instead for 
Did you mean: