0

I want to click on multiple links with the same class using PHPUnit's extension for Selenium2. I am trying to select multiple elements using:

$elements = $this->byClassName('link_class');

However this only selects a single element. How do I select all of my elements and iterate through them?

1 Answer 1

1

So, with a lot of deep digging I found the answer. All of the high level functions to select elements only use the single element selection strategy. In Session.php (as of 3/3/2013) you can see all of the high level method use

protected function by($strategy, $value)
{
    return $this->element($this->using($strategy)->value($value));
}

I added a small method which uses $this->elements instead of $this->element. Then I was able to iterate through. Good luck!

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.