George S. Baugh 4 лет назад
Родитель
Сommit
2b4a035e70
3 измененных файлов с 13 добавлено и 1 удалено
  1. 3 0
      Changes
  2. 1 1
      dist.ini
  3. 9 0
      lib/Playwright.pm

+ 3 - 0
Changes

@@ -1,5 +1,8 @@
 Revision history for Playwright
 
+0.008 2021-07-19 TEODESIAN
+    - Add parent attribute to grab element parents when needed
+
 0.007 2021-06-17 TEODESIAN
     - Adjust module for changing Download returns, and api.json no longer being shipped with Playwright
     - Fix some warnings when installing for the first time.

+ 1 - 1
dist.ini

@@ -1,5 +1,5 @@
 name = Playwright
-version = 0.007
+version = 0.008
 author = George S. Baugh <george@troglodyne.net>
 license = MIT
 copyright_holder = Troglodyne LLC

+ 9 - 0
lib/Playwright.pm

@@ -156,6 +156,15 @@ You will then need to wait on the result of the backgrounded action with the awa
     my $result = $handle->await( $async );
     my $logged = $result->text();
 
+=head2 Getting Object parents
+
+Some things, like elements naturally are children of the pages in which they are found.
+Sometimes this can get confusing when you are using multiple pages, especially if you let the ref to the page go out of scope.
+Don't worry though, you can access the parent attribute on most Playwright::* objects:
+
+    # Assuming $element is a Playwright::ElementHandle
+    my $page = $element->{parent};
+
 =head1 INSTALLATION NOTE
 
 If you install this module from CPAN, you will likely encounter a croak() telling you to install node module dependencies.