• <small id='2Hd3e'></small><noframes id='2Hd3e'>

    • <bdo id='2Hd3e'></bdo><ul id='2Hd3e'></ul>
    <legend id='2Hd3e'><style id='2Hd3e'><dir id='2Hd3e'><q id='2Hd3e'></q></dir></style></legend>

        <i id='2Hd3e'><tr id='2Hd3e'><dt id='2Hd3e'><q id='2Hd3e'><span id='2Hd3e'><b id='2Hd3e'><form id='2Hd3e'><ins id='2Hd3e'></ins><ul id='2Hd3e'></ul><sub id='2Hd3e'></sub></form><legend id='2Hd3e'></legend><bdo id='2Hd3e'><pre id='2Hd3e'><center id='2Hd3e'></center></pre></bdo></b><th id='2Hd3e'></th></span></q></dt></tr></i><div id='2Hd3e'><tfoot id='2Hd3e'></tfoot><dl id='2Hd3e'><fieldset id='2Hd3e'></fieldset></dl></div>
        <tfoot id='2Hd3e'></tfoot>

        Selenium C# 打开新选项卡 CTRL+T 不使用 CHROME

        时间:2023-09-14
            <tbody id='hEMLo'></tbody>

                • <bdo id='hEMLo'></bdo><ul id='hEMLo'></ul>

                  <i id='hEMLo'><tr id='hEMLo'><dt id='hEMLo'><q id='hEMLo'><span id='hEMLo'><b id='hEMLo'><form id='hEMLo'><ins id='hEMLo'></ins><ul id='hEMLo'></ul><sub id='hEMLo'></sub></form><legend id='hEMLo'></legend><bdo id='hEMLo'><pre id='hEMLo'><center id='hEMLo'></center></pre></bdo></b><th id='hEMLo'></th></span></q></dt></tr></i><div id='hEMLo'><tfoot id='hEMLo'></tfoot><dl id='hEMLo'><fieldset id='hEMLo'></fieldset></dl></div>
                • <small id='hEMLo'></small><noframes id='hEMLo'>

                  <legend id='hEMLo'><style id='hEMLo'><dir id='hEMLo'><q id='hEMLo'></q></dir></style></legend>
                • <tfoot id='hEMLo'></tfoot>
                  本文介绍了Selenium C# 打开新选项卡 CTRL+T 不使用 CHROME的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  static void Main()
                  {
                      IWebDriver driver = new ChromeDriver();
                      driver.Navigate().GoToUrl("http://google.com");
                      IWebElement body = driver.FindElement(By.TagName("body"));
                  
                      body.SendKeys(Keys.Control + "t");
                  
                  }
                  

                  这是我试图用来打开新标签的代码,但它不起作用,我没有收到任何错误,驱动程序打开谷歌,仅此而已....我搜索了很多,发现很多教程甚至视频,人们使用完全相同的代码并且它适用于他们,但对我来说它没有,我无法弄清楚......

                  This is the code that I am trying to use to open a new tab and its not working, I am not getting any errors nothing, the driver opens Google and thats all.... I have searched a lot and found many tutorials even videos where people are using the exact same code and it works for them, but for me it doesnt and I can't figure it out...

                  我尝试将 Keys.Shift + "t" 发送到搜索字段并且它有效,它在字段中写入大写 T

                  I tried sending Keys.Shift + "t" to the search field and it works, it writes a capital T in the field

                  我也试过

                  Actions act = new Actions(driver);
                  act.KeyDown(Keys.Control).SendKeys("t").Perform();
                  

                  它仍然无法正常工作,但如果我将 Keys.Control 更改为 Keys.Shift 它会再次写入,似乎没有任何涉及 Keys.Control 的工作!

                  And it still does not work, but again if I change Keys.Control to Keys.Shift it writes, seems like nothing that involves Keys.Control is working!!

                  我尝试使用 IE 驱动程序运行代码,它在那里工作,它打开了新标签,但它没有在 Chrome 上打开新标签?

                  I have tried running the code with a IE Driver and it worked there, it opens new tab, but it does not open new tabs on Chrome?

                  推荐答案

                  感谢您的回答!我是用 JavaScript 做到的.

                  Thanks for the answers! I did it with JavaScript.

                  ((IJavaScriptExecutor)driver).ExecuteScript("window.open();");
                  

                  这篇关于Selenium C# 打开新选项卡 CTRL+T 不使用 CHROME的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:Selenium ChromeDriver 如何禁用消息:"DevTools on ws 下一篇:C# Selenium/ChromeDriver 添加用户配置文件首选项

                  相关文章

                • <small id='QmomS'></small><noframes id='QmomS'>

                  <legend id='QmomS'><style id='QmomS'><dir id='QmomS'><q id='QmomS'></q></dir></style></legend>

                    • <bdo id='QmomS'></bdo><ul id='QmomS'></ul>
                  1. <tfoot id='QmomS'></tfoot>

                      <i id='QmomS'><tr id='QmomS'><dt id='QmomS'><q id='QmomS'><span id='QmomS'><b id='QmomS'><form id='QmomS'><ins id='QmomS'></ins><ul id='QmomS'></ul><sub id='QmomS'></sub></form><legend id='QmomS'></legend><bdo id='QmomS'><pre id='QmomS'><center id='QmomS'></center></pre></bdo></b><th id='QmomS'></th></span></q></dt></tr></i><div id='QmomS'><tfoot id='QmomS'></tfoot><dl id='QmomS'><fieldset id='QmomS'></fieldset></dl></div>