- 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.
推薦閱讀
- Linux網絡管理與配置(第2版)
- Linux內核完全注釋(20周年版·第2版)
- Mastering Distributed Tracing
- Hands-On DevOps with Vagrant
- 注冊表應用完全DIY
- 一學就會:Windows Vista應用完全自學手冊
- RHCSARHCE 紅帽Linux認證學習指南(第7版)EX200 & EX300
- Linux系統最佳實踐工具:命令行技術
- Learning BeagleBone
- Linux應用大全 基礎與管理
- Web Penetration Testing with Kali Linux(Third Edition)
- 大規模分布式系統架構與設計實戰
- VMware vSphere 5.1 Cookbook
- Game Data Analysis:Tools and Methods
- Linux系統編程