… | |
… | |
187 | specify a value of C<default>. |
187 | specify a value of C<default>. |
188 | |
188 | |
189 | =item autodelete => $boolean |
189 | =item autodelete => $boolean |
190 | |
190 | |
191 | If true (the default), then automatically execute C<delete_session> when |
191 | If true (the default), then automatically execute C<delete_session> when |
192 | the WebDriver object is destroyed with an active session. IF set to a |
192 | the WebDriver object is destroyed with an active session. If set to a |
193 | false value, then the session will continue to exist. |
193 | false value, then the session will continue to exist. |
194 | |
194 | |
|
|
195 | Note that due to bugs in perl that are unlikely to get fixed, |
|
|
196 | C<autodelete> is likely ineffective during global destruction and might |
|
|
197 | even crash your process, so you should ensure objects go out of scope |
|
|
198 | before that, or explicitly call C<delete_session>, if you want the session |
|
|
199 | to be cleaned up. |
|
|
200 | |
195 | =item timeout => $seconds |
201 | =item timeout => $seconds |
196 | |
202 | |
197 | The HTTP timeout, in (fractional) seconds (default: C<300>, but this will |
203 | The HTTP timeout, in (fractional) seconds (default: C<300>). This timeout |
198 | likely drastically reduce). This timeout is reset on any activity, so it |
204 | is reset on any activity, so it is not an overall request timeout. Also, |
199 | is not an overall request timeout. Also, individual requests might extend |
205 | individual requests might extend this timeout if they are known to take |
200 | this timeout if they are known to take longer. |
206 | longer. |
201 | |
207 | |
202 | =item persistent => C<1> | C<undef> |
208 | =item persistent => C<1> | C<undef> |
203 | |
209 | |
204 | If true (the default) then persistent connections will be used for all |
210 | If true (the default) then persistent connections will be used for all |
205 | requests, which assumes you have a reasonably stable connection (such as |
211 | requests, which assumes you have a reasonably stable connection (such as |
… | |
… | |
228 | |
234 | |
229 | sub DESTROY { |
235 | sub DESTROY { |
230 | my ($self) = @_; |
236 | my ($self) = @_; |
231 | |
237 | |
232 | $self->delete_session |
238 | $self->delete_session |
233 | if exists $self->{sid}; |
239 | if exists $self->{sid} && $self->{autodelete}; |
234 | } |
240 | } |
235 | |
241 | |
236 | =item $al = $wd->actions |
242 | =item $al = $wd->actions |
237 | |
243 | |
238 | Creates an action list associated with this WebDriver. See L<ACTION |
244 | Creates an action list associated with this WebDriver. See L<ACTION |
… | |
… | |
414 | } |
420 | } |
415 | |
421 | |
416 | =item $wd->delete_session |
422 | =item $wd->delete_session |
417 | |
423 | |
418 | Deletes the session - the WebDriver object must not be used after this |
424 | Deletes the session - the WebDriver object must not be used after this |
419 | call. |
425 | call (except for calling this method). |
|
|
426 | |
|
|
427 | This method is always safe to call and will not do anything if there is no |
|
|
428 | active session. |
420 | |
429 | |
421 | =cut |
430 | =cut |
422 | |
431 | |
423 | sub delete_session_ { |
432 | sub delete_session_ { |
424 | my ($self, $cb) = @_; |
433 | my ($self, $cb) = @_; |
425 | |
434 | |
|
|
435 | my $sid = delete $self->{sid}; |
|
|
436 | delete $self->{capoabilities}; |
|
|
437 | |
|
|
438 | return unless defined $sid; |
|
|
439 | |
426 | local $self->{_ep} = "$self->{endpoint}/session/$self->{sid}"; |
440 | local $self->{_ep} = "$self->{endpoint}/session/$sid"; |
427 | $self->delete_ ("" => $cb); |
441 | $self->delete_ ("" => $cb); |
428 | } |
442 | } |
429 | |
443 | |
430 | =item $timeouts = $wd->get_timeouts |
444 | =item $timeouts = $wd->get_timeouts |
431 | |
445 | |