I am building a python3 web bot using selenium-webdriver and don't have too much experience with selenium. I am getting an exception, "selenium.common.exceptions.InvalidSelectorException: Message: invalid selector: An invalid or illegal selector was specified", because of this line of code:
browser.find_element_by_css_selector("button[ng-click='$ctrl.login('gatorlink')']").click();
I'm fairly certain it's related to the single quotes surrounding the string "gatorlink", but I am really not sure. I know the selector is not correct. This is the button I am trying to click.
<button class="md-button md-ink-ripple" type="button" ng-transclude="" ng-click="$ctrl.login('gatorlink')" role="menuitem">
<md-icon class="ng-scope material-icons" role="img" aria-label="exit_to_app">exit_to_app</md-icon>
<span class="ng-scope">Log in with GatorLink</span>
</button>
It's in a drop down and I am able to open the menu but not click this button at the moment.
ng-clickis an attribute of Angular and I doubt it will work like this. Did you check this?browser.find_element_by_css_selector("button[ng-click=\"$ctrl.login('gatorlink')\"]").click();