@@ -116,7 +116,7 @@ public function locator(string $selector): Locator
116116 */
117117 public function getByRole (string $ role , array $ params = []): Locator
118118 {
119- return new Locator ( $ this ->guid , Selector::getByRoleSelector ($ role , $ params ));
119+ return $ this ->locator ( Selector::getByRoleSelector ($ role , $ params ));
120120 }
121121
122122 /**
@@ -126,47 +126,47 @@ public function getByTestId(string $testId): Locator
126126 {
127127 $ testIdAttributeName = 'data-testid ' ;
128128
129- return new Locator ( $ this ->guid , Selector::getByTestIdSelector ($ testIdAttributeName , $ testId ));
129+ return $ this ->locator ( Selector::getByTestIdSelector ($ testIdAttributeName , $ testId ));
130130 }
131131
132132 /**
133133 * Create a locator that matches elements by alt text.
134134 */
135135 public function getByAltText (string $ text , bool $ exact = false ): Locator
136136 {
137- return new Locator ( $ this ->guid , Selector::getByAltTextSelector ($ text , $ exact ));
137+ return $ this ->locator ( Selector::getByAltTextSelector ($ text , $ exact ));
138138 }
139139
140140 /**
141141 * Create a locator that matches elements by label text.
142142 */
143143 public function getByLabel (string $ text , bool $ exact = false ): Locator
144144 {
145- return new Locator ( $ this ->guid , Selector::getByLabelSelector ($ text , $ exact ));
145+ return $ this ->locator ( Selector::getByLabelSelector ($ text , $ exact ));
146146 }
147147
148148 /**
149149 * Create a locator that matches elements by placeholder text.
150150 */
151151 public function getByPlaceholder (string $ text , bool $ exact = false ): Locator
152152 {
153- return new Locator ( $ this ->guid , Selector::getByPlaceholderSelector ($ text , $ exact ));
153+ return $ this ->locator ( Selector::getByPlaceholderSelector ($ text , $ exact ));
154154 }
155155
156156 /**
157157 * Create a locator that matches elements by text content.
158158 */
159159 public function getByText (string $ text , bool $ exact = false ): Locator
160160 {
161- return new Locator ( $ this ->guid , Selector::getByTextSelector ($ text , $ exact ));
161+ return $ this ->locator ( Selector::getByTextSelector ($ text , $ exact ));
162162 }
163163
164164 /**
165165 * Create a locator that matches elements by title attribute.
166166 */
167167 public function getByTitle (string $ text , bool $ exact = false ): Locator
168168 {
169- return new Locator ( $ this ->guid , Selector::getByTitleSelector ($ text , $ exact ));
169+ return $ this ->locator ( Selector::getByTitleSelector ($ text , $ exact ));
170170 }
171171
172172 /**
0 commit comments