Open IAmAlmighty opened 8 years ago
You get an instance of ..._Element
which does not have that information. I suggest to wrap the Element in your own object, so that you can attach to it whatever data you prefer.
I was hoping some of intermediate object between string which we sent there and an instance of ..._Element can store that information and I just can't find it by myself.
Sad news for me because my skills now is too weak for wrap in my own object.
Don't be afraid of trying, you just need a new class:
class MyElement
{
private $element;
private $otherStuff;
public function __construct($element, $otherStuff)
{
$this->element = $element;
$this->otherStuff = $otherStuff;
}
// getters, other methods
}
and to create a Factory Method on some base test case:
public function byXPathMyElement($xpath)
{
return new MyElement($this->byXPath($xpath), $xpath);
}
Ty mate I will try. =)
For example I have: $element = $this->byXPath("//body/div[@class='some_class']");
What can I do with $element to retrieve "//body/div[@class='some_class']" from it?