Difference between revisions of "Troubleshooting of selenium errors"
Jump to navigation
Jump to search
(Created page with "[https://www.selenium.dev/ SeleniumHQ Browser Automation] == How to resolve Uncaught Facebook\WebDriver\Exception\InvalidSelectorException == Error message <pre> PHP Fatal er...") |
|||
(6 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | [https://www.selenium.dev/ SeleniumHQ Browser Automation] | + | [https://www.selenium.dev/ SeleniumHQ Browser Automation] ([https://github.com/php-webdriver/php-webdriver php-webdriver/php-webdriver: PHP client for Selenium/WebDriver protocol. Previously facebook/php-webdriver]) |
+ | |||
+ | == How to tracking the selenium errors == | ||
+ | |||
+ | * Checking the standalone selenium server is running or not {{kbd | key=<nowiki>ps aux | grep selenium</nowiki>}} on {{Linux}} | ||
+ | * Checking the log file of standalone selenium server e.g. launching the server by the command {{kbd | key=<nowiki>sudo nohup java -jar selenium-server-standalone-3.141.59.jar > /home/user/selenium.log 2>&1 &</nowiki>}}. The log file was located at {{kbd | key=<nowiki>/home/user/selenium.log</nowiki>}} | ||
+ | * (optional) Checking the port where the selenium server is running e.g. {{kbd | key=<nowiki>wget http://localhost:4444</nowiki>}} | ||
+ | * Checking the error log file of HTTP server e.g. {{kbd | key=<nowiki>sudo tail /var/log/nginx/error.log</nowiki>}} | ||
+ | * (optional) Checking the error log file of PHP-FPM e.g. {{kbd | key=<nowiki>sudo tail /var/log/www.access.log</nowiki>}} which its file path defined in the configuration file {{kbd | key=<nowiki>/etc/php-fpm.d/www.conf</nowiki>}} | ||
== How to resolve Uncaught Facebook\WebDriver\Exception\InvalidSelectorException == | == How to resolve Uncaught Facebook\WebDriver\Exception\InvalidSelectorException == | ||
Line 14: | Line 22: | ||
* Solution1: Using headless chrome<ref>[https://developers.google.com/web/updates/2017/04/headless-chrome Getting Started with Headless Chrome | Web | Google Developers]</ref> | * Solution1: Using headless chrome<ref>[https://developers.google.com/web/updates/2017/04/headless-chrome Getting Started with Headless Chrome | Web | Google Developers]</ref> | ||
* Solution2: Not click the button which specified by XPath expression. Send the {{kbd | key=ENTER}} to submit the form<ref>[https://stackoverflow.com/questions/21243860/emulate-keypress-in-webdriver-using-php selenium - Emulate keypress in webdriver using php - Stack Overflow]</ref>. | * Solution2: Not click the button which specified by XPath expression. Send the {{kbd | key=ENTER}} to submit the form<ref>[https://stackoverflow.com/questions/21243860/emulate-keypress-in-webdriver-using-php selenium - Emulate keypress in webdriver using php - Stack Overflow]</ref>. | ||
+ | |||
+ | == How to resolve [WARNING]: This version of ChromeDriver only supports Chrome version xx or [WARNING]: This version of ChromeDriver has not been tested with Chrome version 86 == | ||
+ | |||
+ | Situation | ||
+ | * [https://chromedriver.chromium.org/downloads Download] the same version of ChromeDriver with the version installed on the computer or server | ||
+ | * You may need to stop the ChromeDriver in the process list if you could not overwrite the existing ChromeDriver file | ||
+ | ** {{Win}} (1) Open the command prompt with the administrative permission (2) and keyin {{kbd | key=<nowiki>taskkill /IM "chromedriver.exe" /F</nowiki>}} to stop the ChromeDriver process | ||
+ | ** {{Linux}} | ||
+ | * Overwrite the existing ChromeDriver file | ||
== References == | == References == |
Latest revision as of 11:47, 2 November 2020
SeleniumHQ Browser Automation (php-webdriver/php-webdriver: PHP client for Selenium/WebDriver protocol. Previously facebook/php-webdriver)
Contents
- 1 How to tracking the selenium errors
- 2 How to resolve Uncaught Facebook\WebDriver\Exception\InvalidSelectorException
- 3 How to resolve [WARNING]: This version of ChromeDriver only supports Chrome version xx or [WARNING]: This version of ChromeDriver has not been tested with Chrome version 86
- 4 References
How to tracking the selenium errors[edit]
- Checking the standalone selenium server is running or not ps aux | grep selenium on Linux
- Checking the log file of standalone selenium server e.g. launching the server by the command sudo nohup java -jar selenium-server-standalone-3.141.59.jar > /home/user/selenium.log 2>&1 &. The log file was located at /home/user/selenium.log
- (optional) Checking the port where the selenium server is running e.g. wget http://localhost:4444
- Checking the error log file of HTTP server e.g. sudo tail /var/log/nginx/error.log
- (optional) Checking the error log file of PHP-FPM e.g. sudo tail /var/log/www.access.log which its file path defined in the configuration file /etc/php-fpm.d/www.conf
How to resolve Uncaught Facebook\WebDriver\Exception\InvalidSelectorException[edit]
Error message
PHP Fatal error: Uncaught Facebook\WebDriver\Exception\InvalidSelectorException: invalid selector: The result of the xpath expression "xxx" is: [object Attr]. It should be an element. (Session info: chrome=83.0.4103.61) in /path/to/vendor/php-webdriver/webdriver/lib/Exception/WebDriverException.php:105
Situation
- After the term was keyed in into the text box, the script shuld auto click the specified button which specified by XPath expression.
Possibile soultions
- Solution1: Using headless chrome[1]
- Solution2: Not click the button which specified by XPath expression. Send the ENTER to submit the form[2].
How to resolve [WARNING]: This version of ChromeDriver only supports Chrome version xx or [WARNING]: This version of ChromeDriver has not been tested with Chrome version 86[edit]
Situation
- Download the same version of ChromeDriver with the version installed on the computer or server
- You may need to stop the ChromeDriver in the process list if you could not overwrite the existing ChromeDriver file
- Overwrite the existing ChromeDriver file
References[edit]
Troubleshooting of ...
- Troubleshooting of Excel errors
- PHP, cUrl, Python, selenium errors
- Database: SQL syntax debug, MySQL errors or MySQLTuner errors
- Troubleshooting of regular expression
- HTML/Javascript: Troubleshooting of javascript, XPath
- Software: Mediawiki, FTP problems
- Testing, Web Ping, Network problem, Web user behavior, Web scrape troubleshooting
Template