How can i Scroll to view an element and click in TestComplete with Javascript?
SOLVED- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How can i Scroll to view an element and click in TestComplete with Javascript?
How can i Scroll to view an element and click in TestComplete with Javascript for web testing? Does TestComplete supports this control(Scroll into view element ).
See the example of selenium code controls below:
var element = driver.FindElement(By.id("element-id"));
Actions actions = new Actions(driver);
actions.MoveToElement(element);
actions.Perform();
-------------------------------------------------------------------------------------------------
See the example of selenium code with Javascript:
(JavascriptExecutor) driver).executeScript("arguments[0].scrollIntoView(true);", element);
Solved! Go to Solution.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
FindChildEx would be similar to the driver.FindElement function, and element.scrollIntoView will allow you to scroll to the object.
Thanks,
Carson
Click the Accept as Solution button if my answer has helped
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Yes, scrollIntoView(true/false) is a native method that is supported by all browsers and can be used to scroll the element into view. Something like that:
var element = page.FindChild(...);
if (element.Exists)
{
element.scrollIntoView(true);
element.click();
}
Update: ah, just noted that I duplicated reply from @cunderw...
/Alex [Community Champion]
____
[Community Champions] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Champions]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Champion] signature is assigned on quarterly basis and is used with permission by SmartBear Software.
https://community.smartbear.com/t5/Community-Champions/About-the-Community-Champions-Program/gpm-p/252662
================================
