- 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 2019 Cookbook
- Puppet實戰
- UNIX操作系統設計
- Windows Phone 7.5 Data Cookbook
- Linux性能優化
- 網絡操作系統教程:Windows Server 2016管理與配置
- Linux使用和管理指南:從云原生到可觀測性
- 直播系統開發:基于Nginx與Nginx-rtmp-module
- Learning Bootstrap
- INSTANT Migration from Windows Server 2008 and 2008 R2 to 2012 How-to
- 一學就會:Windows Vista應用完全自學手冊
- iOS 8開發指南
- 新編電腦辦公(Windows 10+ Office 2013版)從入門到精通
- Windows 10從新手到高手
- Linux軟件管理平臺設計與實現