RE: How to handle dynamically generated id with XPath
Simple answer is that your xpath showuld not use the ID to identify element, try to reach to the element via relation to parent elements.
There is aa button “New Browser Window” on this web page. The id of the web element is “button1″. NOw using xpath there are two ways to identify the element. First is directly by ID like this
Second is by parent child relation of the element
in your case as ID is changing you cannot rely on the 1 st for of Xpath, the one that uses id.
Also you can use css selector instead, that should be a better approach.