Reputation: 2174
I have div and hyperlink like this:
<div id="food-add-actions" class="actions food_dialog fd_food_dialog_s-fndds2-f41210000">
<div class="right">
<a href="Javascript://" class="food-add-button add button"><span></span><span>Add to Food Log</span></a>
<a href="Javascript://" class="edit button"><span></span><span>Edit</span></a>
</div>
</div>
how can i click on this Edit
hyperlink?
i tried below but it did not worked for me
driver.findElement(By.className("edit button")).click();
Upvotes: 0
Views: 3512
Reputation: 4273
The problem you actually have is that you have a space in your By.className.
There is a question with a similar problem here.
webdriver classname with space using java
You should be able to select it with a By.css selector, such as.
By.css('.right a.button')
Upvotes: 1