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

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. 
主站蜘蛛池模板: 宽甸| 灵武市| 思茅市| 醴陵市| 西昌市| 革吉县| 天柱县| 江津市| 扎兰屯市| 湘阴县| 任丘市| 来安县| 穆棱市| 政和县| 安泽县| 疏勒县| 柞水县| 乐至县| 马尔康县| 龙陵县| 安庆市| 霍邱县| 道真| 襄垣县| 金昌市| 永安市| 堆龙德庆县| 志丹县| 永丰县| 屏南县| 娱乐| 黔江区| 阿荣旗| 石首市| 年辖:市辖区| 姚安县| 鱼台县| 垫江县| 土默特左旗| 清镇市| 那曲县|