官术网_书友最值得收藏!

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. 
主站蜘蛛池模板: 利川市| 崇文区| 车险| 柘城县| 鱼台县| 平武县| 武定县| 定远县| 岳西县| 故城县| 祁连县| 临沂市| 吉林省| 东乌| 正安县| 纳雍县| 岳阳市| 集贤县| 基隆市| 湄潭县| 伊通| 全南县| 彰武县| 博白县| 康乐县| 嵊州市| 云安县| 普兰店市| 来宾市| 达拉特旗| 萨嘎县| 宝山区| 惠东县| 乃东县| 永登县| 道真| 怀来县| 东源县| 兰西县| 天长市| 廊坊市|