cancel
Showing results for 
Search instead for 
Did you mean: 

Web page need to scroll to see an element

Mike_Martin
New Contributor

Web page need to scroll to see an element

I have an element

page.FindElement(".ag-body-horizontal-scroll-viewport")

I need to drag it until 

(//div [@col-id='XePatientVisit.WorkID.XeWorkflowInstanceState.0.WorkState' ])[2]

shows up. 

 

There are different entries so the length keeps changing. 

 

Also changes if I use a  bigger screen.

2 REPLIES 2
ebarbera
Staff

Re: Web page need to scroll to see an element

hi @Mike_Martin - 

 

I would suggest using a while loop here - while (//div [@col-id='XePatientVisit.WorkID.XeWorkflowInstanceState.0.WorkState' ])[2] does not exist or isn't visible - scroll a certain amount.

 

https://support.smartbear.com/testcomplete/docs/keyword-testing/reference/statements/while-loop.html

 

Let me know if you have questions.

 

Thanks, 
Emma

Mike_Martin
New Contributor

Re: Web page need to scroll to see an element

Sorry I should have been more specific.

I want to do a while loop to scroll this page.FindElement(".ag-body-horizontal-scroll-viewport") until this is present. I set it to continue on errors but I get 

Unable to find the object "(//div [@col-id='XePatientVisit.WorkID.XeWorkflowInstanceState.0.WorkState'])[2] ". See Details for additional information.

If I have a bigger screen it fails to find the object.

I have it set to continue on errors so why am I getting an error

 

while Project.Variables.queue == 'blank':

    x=100+100
    page.panel19.Drag(x, 5, 86, 3) or  I try page.panel19.Click()

    Project.Variables.queue= page.FindElement("(//div [@col-      id='XePatientVisit.WorkID.XeWorkflowInstanceState.0.WorkState'])[2] ").contentText

New Here?
Join us and watch the welcome video:
Announcements