这是一个创建于 2528 天前的主题,其中的信息可能已经有所发展或是发生改变。
<div>
<form novalidate="" name="loginForm" id="bc-login-form" class="bc-form bc-login-form ng-pristine ng-invalid ng-invalid-required" data-ng-submit="login(loginForm)">
<div class="form-group" data-ng-class="{'error-input':loginForm.email.$invalid && loginForm.$submitted}">
<input type="text" class="form-input form-field-login ng-pristine ng-invalid ng-invalid-required ng-touched placeholder" data-ng-class="{'remove-chrome-highlight':loginForm.email.$invalid && loginForm.$submitted}" placeholder="Login with email" name="email" autofocus="" required="" data-ng-model="user.email">
</div>
<div class="form-group group-pass-submit row collapse">
<div class="small-10 columns field-password-wrapper small-12" data-ng-class="{'error-input':loginForm.password.$invalid && loginForm.$submitted, 'small-12': !ref}">
<input type="password" data-hj-masked="" id="login-form-password" data-ng-class="{'remove-chrome-highlight':loginForm.password.$invalid && loginForm.$submitted}" class="form-input form-field-password ng-pristine ng-untouched ng-invalid ng-invalid-required" placeholder="Password" name="password" required="" data-ng-model="user.password">
<span password-id="'login-form-password'" class="peek-at-password">show</span>
</div>
<!-- ngIf: ref -->
</div>
<div class="form-group row collapse form-extra-nav">
<div class="small-6 columns">
<div class="input-checkbox">
<input id="rememeber_me" name="rememeber_me" data-ng-model="user.remember" type="checkbox" checked="checked" class="ng-pristine ng-untouched ng-valid">
<label for="rememeber_me">
<span class="bc-glyph-check"></span>
Remember Me
</label>
</div>
</div>
<div class="small-6 columns forgot-pass-link">
<a href="" data-ng-click="goToForgot()">Forgot Password?</a>
</div>
</div>
<div id="g-login-component" class="g-recaptcha"></div>
<div>
<div class="error-block ng-hide" data-ng-show="hasErrors" data-form="loginForm" data-errors="errors">
<p class="error-text" data-ng-show="form.$error.required">
Complete required fields to continue.
</p>
<p class="error-text ng-hide" data-ng-show="form.email.$invalid && !form.email.$error.required">
Enter a valid email.
</p>
<p class="error-text ng-hide" data-ng-show="form.$error.invalidCaptcha">
Please complete the reCAPTCHA to continue.
</p>
<p class="error-text ng-hide" data-ng-show="errors.required_captcha">
Please complete the reCAPTCHA to continue.
</p>
<p class="error-text ng-hide" data-ng-show="form.$error.invalidEmail">
Please enter a valid email
</p>
<p class="error-text ng-hide" data-ng-show="form.$error.invalidOneword">
Only one value is allowed.
</p>
<p class="error-text ng-hide" data-ng-show="errors.server_error">
Oops, something went wrong. Please refresh the page and try again.
</p>
<p class="error-text ng-hide" data-ng-show="form.password.$error.minlength && !form.password.$error.required">
Password must be at least 6 characters.
</p>
<p class="error-text ng-hide" data-ng-show="errors.recaptcha">
Please complete the reCAPTCHA to continue.
</p>
<!-- ngIf: errors.email_does_not_exist -->
<p class="error-text ng-hide" data-ng-show="errors.password_email_does_not_exist">
We could not locate an account that uses this email address. Try again, <a data-bc-go-to-register="">create an account</a>, or <a href="/contact"> contact our support team for assistance.</a>
</p>
<p class="error-text ng-binding ng-hide" data-ng-show="errors.email" data-bc-bind-unsafe="errors.email"></p>
<p class="error-text ng-hide" data-ng-show="errors.default" data-ng-bind-html="errors.default">false</p>
<p class="error-text ng-binding ng-hide" data-ng-show="errors.unsafe_default" data-bc-bind-unsafe="errors.unsafe_default"></p>
<p class="error-text ng-binding ng-hide" data-ng-show="errors.password_does_not_match" data-bc-bind-unsafe="errors.password_does_not_match"></p>
<p class="error-text ng-hide" data-ng-show="errors.not_found" data-ng-bind-html="errorMessages.not_found"></p>
<p class="error-text js-incomplete ng-hide" data-ng-show="errors.incomplete"></p>
<!-- ngIf: errors.password_incomplete -->
</div>
</div>
<!-- ngIf: !ref --><div data-ng-if="!ref" class="form-group text-center">
<button type="submit" class="bc-button light-blue full-width-login-btn">Log In</button>
</div><!-- end ngIf: !ref -->
</form>
</div>
======================
上面的 password 比较好定位,就是 username 用 byclassname=orm-input form-field-login ng-pristine ng-invalid ng-invalid-required ng-touched placeholder 定位不了,用 //div[@class='form-group']/input[name()='email']也不行,该如何定位呢。居然 username 没有 id ?
8 条回复 • 2017-12-25 10:18:20 +08:00
|
|
1
jahan 2017-12-23 20:21:49 +08:00
|
|
|
2
jahan 2017-12-23 20:38:34 +08:00
find_elementsbyname 倒是可以找到,这个输入,不过为什么 xpath 不行,byclassname 也不行呢?
|
|
|
3
sky48818 2017-12-23 20:42:23 +08:00 via Android
block
|
|
|
4
wangyongbo 2017-12-23 21:32:52 +08:00
$x("//div[@class='form-group']/input[@name='email']") 这个在 chrome 的 console 里面可以用。
|
|
|
5
ysc3839 2017-12-24 02:38:04 +08:00 via Android
form 有 ID,下面的第一个 input 就是了。
|
|
|
6
shuizhengqi 2017-12-24 09:30:52 +08:00 via iPhone 1
你这发的是什么玩意,我看着都 tm 累
|
|
|
7
jahan 2017-12-24 09:49:01 +08:00
|
|
|
8
dirls 2017-12-25 10:18:20 +08:00
@ wangyongbo chrome console 能找到,而程序 xpath 找不到,可能是页面 html 源码不标准,chrome 渲染时自动做了修正。
|