ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/AnyEvent-WebDriver/WebDriver.pm
(Generate patch)

Comparing AnyEvent-WebDriver/WebDriver.pm (file contents):
Revision 1.42 by root, Fri Sep 20 20:15:58 2019 UTC vs.
Revision 1.43 by root, Fri Sep 20 20:35:18 2019 UTC

187specify a value of C<default>. 187specify a value of C<default>.
188 188
189=item autodelete => $boolean 189=item autodelete => $boolean
190 190
191If true (the default), then automatically execute C<delete_session> when 191If true (the default), then automatically execute C<delete_session> when
192the WebDriver object is destroyed with an active session. IF set to a 192the WebDriver object is destroyed with an active session. If set to a
193false value, then the session will continue to exist. 193false value, then the session will continue to exist.
194 194
195Note that due to bugs in perl that are unlikely to get fixed,
196C<autodelete> is likely ineffective during global destruction and might
197even crash your process, so you should ensure objects go out of scope
198before that, or explicitly call C<delete_session>, if you want the session
199to be cleaned up.
200
195=item timeout => $seconds 201=item timeout => $seconds
196 202
197The HTTP timeout, in (fractional) seconds (default: C<300>, but this will 203The HTTP timeout, in (fractional) seconds (default: C<300>). This timeout
198likely drastically reduce). This timeout is reset on any activity, so it 204is reset on any activity, so it is not an overall request timeout. Also,
199is not an overall request timeout. Also, individual requests might extend 205individual requests might extend this timeout if they are known to take
200this timeout if they are known to take longer. 206longer.
201 207
202=item persistent => C<1> | C<undef> 208=item persistent => C<1> | C<undef>
203 209
204If true (the default) then persistent connections will be used for all 210If true (the default) then persistent connections will be used for all
205requests, which assumes you have a reasonably stable connection (such as 211requests, which assumes you have a reasonably stable connection (such as
228 234
229sub DESTROY { 235sub 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
238Creates an action list associated with this WebDriver. See L<ACTION 244Creates 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
418Deletes the session - the WebDriver object must not be used after this 424Deletes the session - the WebDriver object must not be used after this
419call. 425call (except for calling this method).
426
427This method is always safe to call and will not do anything if there is no
428active session.
420 429
421=cut 430=cut
422 431
423sub delete_session_ { 432sub 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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines