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

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. 
主站蜘蛛池模板: 游戏| 金阳县| 茂名市| 若尔盖县| 托里县| 大竹县| 穆棱市| 峨山| 留坝县| 广昌县| 吕梁市| 合作市| 郧西县| 台湾省| 富顺县| 龙井市| 文昌市| 朝阳区| 左云县| 孝昌县| 连平县| 广平县| 滨州市| 中方县| 祥云县| 镇远县| 日喀则市| 嘉义市| 琼结县| 礼泉县| 金堂县| 余江县| 虎林市| 祁东县| 阳东县| 肥城市| 泽州县| 东安县| 枞阳县| 塔河县| 大埔区|