Skip to content

Commit bafe9fc

Browse files
committed
refactor: remove waitForSelector method from Element and Locator classes
1 parent 30e02d5 commit bafe9fc

2 files changed

Lines changed: 0 additions & 47 deletions

File tree

src/Playwright/Element.php

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -146,24 +146,6 @@ public function selectText(?array $options = null): void
146146
$this->processVoidResponse($this->sendMessage('selectText', $options ?? []));
147147
}
148148

149-
/**
150-
* Wait for a selector to appear relative to this element.
151-
*
152-
* @param array<string, mixed>|null $options
153-
*/
154-
public function waitForSelector(string $selector, ?array $options = null): ?self
155-
{
156-
$params = array_merge(['selector' => $selector], $options ?? []);
157-
158-
$element = $this->processElementCreationResponse($this->sendMessage('waitForSelector', $params));
159-
160-
if (! $element instanceof self) {
161-
return null;
162-
}
163-
164-
return new self($element->guid);
165-
}
166-
167149
/**
168150
* Get the content frame for iframe elements.
169151
*/

src/Playwright/Locator.php

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -668,35 +668,6 @@ public function waitForElementState(string $state, ?array $options = null): void
668668
$element->waitForElementState($state, $options);
669669
}
670670

671-
/**
672-
* Wait for a selector to appear relative to this locator.
673-
*
674-
* @param array<string, mixed>|null $options
675-
*/
676-
public function waitForSelector(string $selector, ?array $options = null): ?self
677-
{
678-
$element = $this->elementHandle();
679-
if (! $element instanceof Element) {
680-
throw new RuntimeException('Element not found');
681-
}
682-
683-
try {
684-
$foundElement = $element->waitForSelector($selector, $options);
685-
if (! $foundElement instanceof Element) {
686-
return null;
687-
}
688-
689-
// Create a new locator using the found element's selector
690-
return $this->locator($selector);
691-
} catch (RuntimeException $e) {
692-
// Handle timeout exceptions by returning null
693-
if (mb_strpos($e->getMessage(), 'Timeout') !== false) {
694-
return null;
695-
}
696-
throw $e;
697-
}
698-
}
699-
700671
/**
701672
* Get the content frame for iframe elements.
702673
*

0 commit comments

Comments
 (0)