How do I get the current DOM with Selenium Java 2.8?

醉酒当歌 提交于 2019-12-05 05:09:55

I have the same question really but the only way I've found to do it is ExecuteScript:

/// <summary>
        /// Gets the parentElement/Node of a particular element
        /// </summary>
        /// <param name="driver"></param>
        /// <param name="element"></param>
        /// <returns></returns>
        public static IWebElement GetElementParent(IWebDriver driver,IWebElement element)
        {
            return (IWebElement) ((IJavaScriptExecutor)driver).ExecuteScript("return arguments[0].parentNode", element);
        }

why the By doesnt support By.DOM with a function I don't really know...I suspect its due to the need for a webdriver for multiple browsers etc

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!