暂时停止Chrome标签页的切换可见性

时间:2019-09-12 18:03:59

标签: c# google-chrome

我使用Selenium使用Chrome。该任务的实质是使用所需的URL切换到窗口。

此代码有效。但与此同时,Chrome疯狂地翻动页面。我需要停一会儿chrome中的所有切换标签,直到找到所需的标签。如何提高速度?预先感谢

        string current_url = GetActiveTabUrl();

        // Here i need to stop the animation of switching tabs

        foreach (string k in Browser.WindowHandles)
        {
            Browser.SwitchTo().Window(k);

            if (Browser.Url.ToString().Contains(current_url))
            {
                // Here i need to bring everything back to normal
                string name = "Undefined";
                name = Browser.FindElement(By.XPath("//*[@id='lot_title']")).GetAttribute("value").ToString();

                set_a_photo(chosePicture(name));

                break;
            }
        }

0 个答案:

没有答案