Forum Discussion

12 Replies

  • eykxas's avatar
    eykxas
    Frequent Contributor

    I can't tell you which value is appropriate for your case. In my test, the image is not visible at -300. But it depends on how various elements of your webpage are organized.

  • eykxas's avatar
    eykxas
    Frequent Contributor

    Hi, do you have an example ? Each object has a property "VisibleOnScreen". You can check that property whenever you want. Maybe this could solve your problem.

     

    Sometimes, the VisibleOnScreen is always false, in this case you have to find an other trick to do this check. (for example, you can check the value of ScreenTop or something like that).

    • ḥari's avatar
      ḥari
      Frequent Contributor
      eykxas i have verified in object browser visible onscreen property for all the panel it's showing false only. What else I can do?
  • eykxas's avatar
    eykxas
    Frequent Contributor

    If I understand properly : your image is fixed when you start scrolling, then the image start scrolling too when you reach a certain point in your webpage, and you want to check the image in both case (fixed, then moving) is that right ?

    • ḥari's avatar
      ḥari
      Frequent Contributor
      Yeah, they have added hero image using css style in background image as url (ie) parallax image,while am start scrolling the page that image is scrolling in background of that page till some point.
      I want to verify while scrolling that image is visible and at the end of the page that image is not visible.
      I have tried visible method if it's not visible on that page end also it's getting true only and in object browser I checked that property as visibleonscreen is false
  • eykxas's avatar
    eykxas
    Frequent Contributor

    Try to get the image object or the container that move with the image. And check the "ScreenTop" value.

    If the ScreenTop value is below a certain value (maybe -200 px or something) you know that the image is no longer visible. It's not ideal but I don't know what else to do.

    • ḥari's avatar
      ḥari
      Frequent Contributor
      eykxas thank you if it's visible the screentop value is 300 something if it's not visible it's -556 if it's not ideal I will try viewport concept or something else. Thank you
  • rraghvani's avatar
    rraghvani
    Champion Level 3

    If you are using Chrome, then press F12 to launch the DevTools. You can view all the Elements that appear on the page, as well as seeing the values changing while scrolling the page. From here, choose the appropriate property to be used in TestComplete to test for.

    • ḥari's avatar
      ḥari
      Frequent Contributor
      I am using both chrome and edge. I am not looking for element values am looking for that element is visible on screen or not while am scrolling, but in object browser that visible property is always true and visibleonscreen property is always false that's my problem
  • rraghvani's avatar
    rraghvani
    Champion Level 3

    I understand that. 

     

    But you have to understand how your page is built, as not all CSS pages will have that property value set. In this example the visibility value changes depending on how much is scrolled,

    It can be seen clearly while using DevTools. 

     

    You might have different element, property, attribute value that's changing which might not be shown in TC. 

    • ḥari's avatar
      ḥari
      Frequent Contributor
      In devtool i didn't see any visibility property over there.
      Can i use like this
      Var img=page.findelement("xpath"). getBoundingClientRect(). top;
      If(img>0)
      Log. Message ("visible")
      Else
      Log. Message ("not visible")

      After scroll to some point
      If(img<0)
      Log. Message ()
      Else
      Log. Message ()

      Here img value before scrolling greater than 0 value after scrolling less than 0
      If I am wrong correct me