Troubleshooting of selenium errors: Difference between revisions
Jump to navigation
Jump to search
| (2 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
[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]) | [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 | == How to resolve the selenium errors == | ||
* Checking the standalone selenium server is running or not {{kbd | key=<nowiki>ps aux | grep selenium</nowiki>}} on {{Linux}} | * Checking the standalone selenium server is running or not {{kbd | key=<nowiki>ps aux | grep selenium</nowiki>}} on {{Linux}} | ||
| Line 26: | Line 26: | ||
== 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 == | == 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 | Situation: Updating the ChromeDriver | ||
* Before Updating, If you encounter “file in use” errors: | |||
* | ** {{Win}} Open Command Prompt as Administrator, Run command: {{kbd | key=<nowiki>taskkill /IM "chromedriver.exe" /F</nowiki>}} | ||
** {{Win}} | * Two option to update the ChromeDriver | ||
** {{Linux}} | ** Option 1: Manual Download: Download ChromeDriver from [https://chromedriver.chromium.org/downloads ChromeDriver Downloads] | ||
* | ** Option 2: Package Managers: On {{Mac}}/{{Linux}}, use [https://brew.sh/ Homebrew]. On {{Win}}, use [https://chocolatey.org/ Chocolatey]. | ||
* Ensure the version matches your installed Chrome browser. Replace the existing ChromeDriver file | |||
== How to resolve macOS says the *.app is damaged. What now? == | |||
Error message<ref>GoogleChromeLabs/chrome-for-testing https://github.com/GoogleChromeLabs/chrome-for-testing</ref><ref>[https://errerrors.blogspot.com/2023/07/how-to-fix-google-chrome-for-testing.app-is-damaged-and-cannot-be-opened.html 解決「Google Chrome for Testing.app」已損毀,無法打開。 你應該將其丟到「垃圾桶」的問題]</ref> | |||
<pre> | |||
“Google Chrome for Testing.app” is damaged and can’t be opened. You should move it to the Trash. | |||
</pre> | |||
Solution | |||
* Open the terminal, and key-in the following command: | |||
<pre> | |||
xattr -cr 'Google Chrome for Testing.app' | |||
</pre> | |||
== References == | == References == | ||
Latest revision as of 17:52, 7 February 2025
SeleniumHQ Browser Automation (php-webdriver/php-webdriver: PHP client for Selenium/WebDriver protocol. Previously facebook/php-webdriver)
How to resolve 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
- (optional) Checking the keyboard event e.g. CTRL works on Win but not works on macOS
[1]
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
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: Updating the ChromeDriver
- Before Updating, If you encounter “file in use” errors:
- Two option to update the ChromeDriver
- Option 1: Manual Download: Download ChromeDriver from ChromeDriver Downloads
- Option 2: Package Managers: On macOS
/Linux , use Homebrew. On Win , use Chocolatey.
- Ensure the version matches your installed Chrome browser. Replace the existing ChromeDriver file
How to resolve macOS says the *.app is damaged. What now?[edit]
“Google Chrome for Testing.app” is damaged and can’t be opened. You should move it to the Trash.
Solution
- Open the terminal, and key-in the following command:
xattr -cr 'Google Chrome for Testing.app'
References[edit]
- ↑ python - Selenium - send keys - what element should I use - Stack Overflow
- ↑ Getting Started with Headless Chrome | Web | Google Developers
- ↑ selenium - Emulate keypress in webdriver using php - Stack Overflow
- ↑ GoogleChromeLabs/chrome-for-testing https://github.com/GoogleChromeLabs/chrome-for-testing
- ↑ 解決「Google Chrome for Testing.app」已損毀,無法打開。 你應該將其丟到「垃圾桶」的問題
Troubleshooting of ...
- PHP, cUrl, Python, selenium, HTTP status code errors
- Database: SQL syntax debug, MySQL errors, MySQLTuner errors or PostgreSQL errors
- HTML/Javascript: Troubleshooting of javascript, XPath
- Software: Mediawiki, Docker, FTP problems, online conference software
- Test connectivity for the web service, Web Ping, Network problem, Web user behavior, Web scrape troubleshooting
Template