zoukankan      html  css  js  c++  java
  • 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);
            }
  • 相关阅读:
    主元素 .
    Struts2中使用Session .
    不同的路径 .
    判断数独是否合法(LintCode) .
    最大子数组(LintCode) .
    不同的路径 II .
    删除元素(LintCode) .
    Hibernate 与Spring整合出现 hibernate.HibernateException: createCriteria is not valid without active transaction .
    子树(LintCode) .
    Surrounded Regions .
  • 原文地址:https://www.cnblogs.com/NowhereWoman/p/3656626.html
Copyright © 2011-2022 走看看