Z
Z
Zimaell2019-05-30 19:02:21
PHP
Zimaell, 2019-05-30 19:02:21

How to click on a button without id and name PhantomJS PHP?

I use the merlinthemagic phantom add-on to enter in the field or click on the button, I do this

$windowObj->mouseEventOnElement("[id=email]","leftclick");
$windowObj->sendKeyPresses($email);
$windowObj->mouseEventOnElement("[id=signInSubmit]","leftclick");
$windowObj->getDom();

There are buttons without an id but with a name, I do this using the folk poke method
$windowObj->focusElement("[name=namebutton]");
$windowObj->sendKeyPresses(array("Enter"));

works...
But sometimes there are buttons that have neither id nor name, the only thing that unites them is type="submit" , how can you click on the desired button in such a situation?
Maybe somehow by value it is possible or something else ...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
Lazy @BojackHorseman PHP, 2019-05-30
Tag

any element in the dom has an xpath from the root

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question