- Selenium WebDriver Quick Start Guide
- Pinakin Chaubal
- 164字
- 2021-06-24 18:26:29
Customized CSS
Now that we have seen the customized XPath, it's time to look at customized CSS. Remember, CSS can be used only for forward traversal.
The following are some customized CSS examples that one can use while coding the program:
- Using the name attribute: input[name='username']. This CSS identifies the username. Notice there are no '//'s.
- Using the name and type attribute: input[type='password'][name='password']. This will identify the password textbox.
- Using the ID and class: form[id='loginForm'],form[id='loginForm'][class='navbar-form']. These two CSS selectors will identify the login form.
- Using the 'contains' clause: form[id*='Form']. This will identify the form since the ID of the form contains the text Form. Contains is indicated by '*' in CSS.
- Using the 'starts-with' clause: form[id^='login']. This will identify the form since the form ID starts with the text 'login'. starts-with is indicated by '^' in CSS.
- Using the 'ends-with' clause: form[id$='Form']. This will identify the form since the form ID ends with the text 'Form'. ends-with is indicated by '$' in CSS.
推薦閱讀
- Windows Server 2012 Hyper-V:Deploying the Hyper-V Enterprise Server Virtualization Platform
- Linux實戰
- Hands-On DevOps with Vagrant
- 精解Windows 8
- 新手易學:系統安裝與重裝
- Linux集群和自動化運維
- Alfresco 4 Enterprise Content Management Implementation
- 嵌入式實時操作系統:RT-Thread設計與實現
- 一學就會:Windows Vista應用完全自學手冊
- 分布式系統設計實踐
- Introduction to R for Quantitative Finance
- 從實踐中學習Windows滲透測試
- Mastering Windows 8 C++ App Development
- Drupal 7 Cookbook
- 大學計算機應用基礎實踐教程(Windows 7+MS Office 2010)