Closed quyeticb closed 8 years ago
OK, I solved run PhantomJS via socks 5. But Not solve the first problem. Need support!
Hi,
I would select the set of links in class "one" (a.one), then a sub selection using "nth-of-type(n)" like this:
$selector = "a.one:nth-of-type(2)";
You could use getElement() and make sure you have the right link. I also saw you wanted to click the link using mouseEventOnElement() before you edited the issue. In the Readme you will see that mouseEventOnElement() can only click elements that cover an area on the page. A vanilla hyperlink is just a link of text, to click use the clickElement() method instead.
Thanks for fast support. I will check it again.
Now, I have a problem with the function sendKeyPresses
If string to send is utf-8 is always error (timeout error).
You can check and review it.
And If error, these folder in WorkDirectory do not delete, may be error for next PhantomJS instances
What's your OS, version and architecture?
Can you send me the string that fails? The fact that the process does not exit is quite odd. There is only two scenarios I can think of that would cause the process to live beyond the lifetime of the PHP script. That would be if the command you execute is the very first one OR if you are using a very old version of MTS. When did you download MTS and are you using master or a specific release?
Oh, one moment, I create many instances while do not terminate it before. But $windowObj->close() still not working. This is error:
PHP Fatal error: Uncaught Exception: MTS\Common\Devices\Browsers\PhantomJS::browserCloseWindow>> Got result code: 0, EMsg: Failed to close window. Error: ReferenceError: Can't find variable: myArray, ECode: 0 in /MTS/Common/Devices/Browsers/PhantomJS.php:111 Stack trace:
0 /MTS/Common/Devices/Browsers/Base.php(86): MTS\Common\Devices\Browsers\PhantomJS->browserCloseWindow(Object(MTS\Common\Devices\Browsers\Window))
1 /MTS/Common/Devices/Browsers/Window.php(79): MTS\Common\Devices\Browsers\Base->closeWindow(Object(MTS\Common\Devices\Browsers\Window))
2 /test.php(185): MTS\Common\Devices\Browsers\Window->close()
3 {main}
thrown in /MTS/Common/Devices/Browsers/PhantomJS.php on line 111
Are you using the current version of master? If not how old is it?
Since you customized MTS do you have a repository where I can look at the code?
I am puzzled because $windowObj->close() does not invoke terminate of the entire browserObj just that window.
I'm using latest MTS release.
The reason I would like to see the code is that the Exception trace shows:
Can't find variable: myArray, ECode: 0 in /MTS/Common/Devices/Browsers/PhantomJS.php:111
That variable is not defined in the stock MTS package. It's hard to help you without knowing how you customized the package.
Thank you, I will track it again, but I do not modifie PhantomJS.php.
PS: I Like your source code. It is useful, instead of having to use webdriver. You can review the sendKeyPresses
with an unicode string. Ex: sendKeyPresses('Côte dIvoire')
The exception is relayed from the .js executed by phantomJS. It's not a PHP exception originally.
Yes, I fixed it! Thanks!
hello, I want click by classname (many classname duplicate). How to click with classname $n ex:
I Want click link Two
And How do run PhantomJS via Sock 5 proxy?