<div dir="ltr"><div><div><div><div><div><div><div><div><div><div><div><div>Hi,<br><br></div>I had been working on a small feature for Visual Editor :Long external target links being shortened<br></div>Bug-63104<br><br></div>
<div>I had certain queries related to the page objects definition.<br></div>Certain elements like span which have been defined as below in visualeditor_page.rb<br><br>span(:linksuggestion, text: "<a href="http://www.example.com">http://www.example.com</a>")<br>
</div><div>same for:<br>span(:newpage_linksuggestion, text: "DoesNotExist")<br><br></div>I was wondering if suppose I want to reuse these elements ,would I have to define a separate element since identification is by text and changing text might cause the other existing tests to fail.<br>
<br></div>But wouldn't adding another element lead to redundancy.<br><br></div>Also,would identifying the element by xpath help instead of by text?<br></div>probably then we could reuse the element.<br><br></div>I know css identification is not supported for certain types but I checked the documentation on cheezy/pageobjects.<br>
<br></div>xpath seemed to be supported.<br><br></div>I was wondering if there is a workaround for this or is it advisable to add a separate element for my test and identifying by text.<br><br></div>Thanks,<br></div>Jagori<br>
</div>