2016-09-11 17 views

回答

1

嘗試XPath

//form[@class="formclass"]/input[@type="text"] 
//form[@class="formclass"]/input[@type="password"] 

CSS選擇

form.formclass input[type="text"] 
form.formclass input[type="password"] 
+0

目前的一些代碼,如果我們不知道的窗體類的名字嗎?我們如何才能得到元素的最近標識符(如id或name或class或xpath)到元素(沒有標識符的輸入字段)? – learner

0

請嘗試以下

的XPath:

(//form[@class='formclass]//input)[0] 
(//form[@class='formclass]//input)[1] 

CSS:

.formclass input[type='text'] 
.formclass input[type='password'] 
+0

讓我們知道它的工作原理,否則會看到它出錯的地方 – FayazMd

+0

請按照鏈接查找基本的定位器結果 https://seleniummonk.blogspot.in/p/element-locators.html – FayazMd

相關問題