【问题标题】:Javascript not executing into a page using SeleniumJavascript 未在使用 Selenium 的页面中执行
【发布时间】:2020-05-24 06:52:22
【问题描述】:

我的 Javascript 没有使用 Selenium 在我的页面中执行。

我的代码:

    // Create a driver instance for chromedriver
    IWebDriver driver = new ChromeDriver();
    IJavaScriptExecutor js = (IJavaScriptExecutor)driver;

            driver.Manage().Window.Size = new Size(1100, 1100);
            driver.Navigate().GoToUrl("http://www.google.com/");
            js.ExecuteScript("function reloadScrollBars() { document.documentElement.style.overflow = 'auto';  document.body.scroll = 'yes';} function unloadScrollBars(){ document.documentElement.style.overflow = 'hidden'; document.body.scroll = 'no';}");

任何人都可以分享关于它为什么不执行的任何知识吗?

【问题讨论】:

    标签: javascript c# selenium selenium-chromedriver


    【解决方案1】:

    成功了

    js.ExecuteScript("return document.body.style.overflow = 'hidden';");
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-09-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-01-17
      相关资源
      最近更新 更多