Click on elements with dyanmic url change in xpath

The below css Selector I have written.

.custom-scrollbar .content-row:nth-of-type(1) [src=’’]

enter image description here

Problem is i need to click on that edit button but issue is url changes with respect to env. Example- currently its pointing to qa so the url is qa, if its in prod then it will change due to which web element not found error occurs.

I am trying with below code which doesnot works-

List<WebElement> list = pilot.findElements(By.tagName("img"));
        String aa = list.get(3).getAttribute("src");

Please suggest a better approach to play around with these buttons with dynamic url.


Try with following css selector to startswith and endswith


Leave a Reply

Your email address will not be published. Required fields are marked *