Troubleshooting of selenium errors

From LemonWiki共筆
Revision as of 15:58, 26 May 2020 by Planetoid (talk | contribs)
Jump to navigation Jump to search

SeleniumHQ Browser Automation (php-webdriver/php-webdriver: PHP client for Selenium/WebDriver protocol. Previously facebook/php-webdriver)

How to resolve Uncaught Facebook\WebDriver\Exception\InvalidSelectorException

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


  • 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].


Troubleshooting of ...