• Selenium 中抓取dropdown


     个人站点地址:nowherewoman.com

    Problem: Below is the html for dropdown 




    And list
     

    Solution 1:

     refer to Selenium IDE :
    BrowserSeleniumHelper.ClickElementByCssSelector("#SettingTabStrip-2 span.t-input");
    BrowserSeleniumHelper.ClickElementByXpath("//div[8]/div/ul/li[2]");
     
    Solution 2: 
    BrowserSeleniumHelper.InputElementByXpath("//div[@id='SettingTabStrip-2']/div[@class='horizontalLine']/ul/li/div/div/span", "China Kids & Teens");
     
          this solution can't capture the value change event
     
    Solution 3: 
    BrowserSeleniumHelper.ClickElementByCssSelector("#SettingTabStrip-2 span.t-input"); BrowserSeleniumHelper.SendArrowDownByCssSelector("#SettingTabStrip-2 span.t-input"); BrowserSeleniumHelper.SendEnterByCssSelector("#SettingTabStrip-2 span.t-input");
     
     
    Event Reference
         public static void ClickElementByCssSelector(string spanTInput)
            {
                Driver.FindElement(By.CssSelector(spanTInput)).Click();
            }
     
    public static void SendArrowDownByCssSelector(string css)
            {
                Driver.FindElement(By.CssSelector(css)).SendKeys(Keys.ArrowDown);
            }
     
    public static void SendEnterByCssSelector(string css)
            {
                Driver.FindElement(By.CssSelector(css)).SendKeys(Keys.Enter);
            }
  • 相关阅读:
    电子商务运营模式
    PHP 常用资源
    Ajax 常用资源
    java 常用资源
    Net 常用资源
    Web App 响应式页面制作 笔记整理
    移动端click事件延迟300ms该如何解决
    阻止冒泡事件
    关于jquery stopPropagation()阻止冒泡事件
    集算器如何处理类文本数据计算
  • 原文地址:https://www.cnblogs.com/NowhereWoman/p/3656626.html
Copyright © 2020-2023  润新知