Selenium cssSelector and attribute

chima
chima used Ask the Experts™
on
Hello, I got, or it appeared; an extension/plugin, https://getfirebug.com/wiki/index.php/Selectors_Side_Panel, that tells me, Go! is the attribute of css selector "input"
<input onclick="showAlert()" value="Go!" type="button">

Open in new window


I've been searching for, what I believe I once saw; driver.findElement(By.cssSelector(input[@attribute = "Go!"])) ;
But this does not work.  How does one use css Selector with an attribute?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Commented:
Try

driver.findElement(By.cssSelector(input[value='Go!']));

Open in new window

Author

Commented:
Nicholas, thank you for the response.  We/I was missing the outer double quotes .  I checked the following with the Selenium IDE and  this works with the IDE, but not in the script;
driver.findElement(By.cssSelector("input[value = 'Go!'][type = 'button']")).click(); 

Open in new window

I have placed wait statements before and after, this does not help.
Commented:
Don't really know Selenium, I was just using normal CSS logic for the selectors

If it works locally I would be looking at what is different in your live environment - is there multiple inputs with the same value...?

Author

Commented:
Nicholas, this worked, removed the type; driver.findElement(By.cssSelector("input[value = 'Go!']")).click();
I'll issue points tomorrow.  thanks  I can use your help with css

Author

Commented:
Thanks, there more to come.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial