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

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. 
主站蜘蛛池模板: 巴中市| 韶关市| 宜城市| 唐海县| 林西县| 隆德县| 双鸭山市| 达孜县| 哈密市| 涞源县| 民乐县| 屏东市| 治多县| 阳信县| 平昌县| 百色市| 平阴县| 清镇市| 云南省| 扶沟县| 安康市| 绥中县| 镇雄县| 陕西省| 阳山县| 咸丰县| 大英县| 桂平市| 成武县| 黑山县| 广河县| 岚皋县| 东乡县| 卢龙县| 钟山县| 中超| 文登市| 达拉特旗| 中卫市| 南康市| 阜阳市|