Forum Discussion
I spoke with my developer and we do not name the our information in our website. This is apparently being named by the TestComplete product.
Here is the information that I found using the object spy.
Sys.Browser("edge").Page(FindElement("//div[6]/div[contains(@class, 'ant-select-item-option-content')]")
FindElement("//div[6]/div[contains(@class, 'ant-select-item-option-content')]")
I took the element name from the name property.
How would be a good way to generate the right kind of script for a csv file that I will be using.
Hi,
> we do not name the our information in our website.
This is definitely the approach that makes your life significantly more difficult.
If developers cannot/do not want to add unique and stable identifiers to web elements your test code needs to interact with and you cannot convince them to do this, then your options are either to use OCR (and pay extra for additional license) or stick to those generic XPath-es that you provided and inform your stakeholders that test code will be quite brittle and flaky despite all your efforts.
Note: Unless you are going to execute your tests using browser cloud providers (like CrossBrowserTesting or BrowserStack), I would recommend to disable the Project Options | Open Applications | Web Testing -> Use XPath and CSS Selectors For Web Objects setting and switch from cross-platform to 'classic' web elements search mode which is way more functional, faster and convenient.
> csv file that I will be using
Your code will depend on what you are going to have in this .csv file and the identification approach that you will use to find required 'anchor' web element that I mentioned in my previous reply.
- AlexKaras3 years agoChampion Level 3
Hi,
> they won't name a specific element listing
Slightly extreme, but nevertheless: one will not get either good codebase or test code if relevant efforts were not invested into architecture.
To sum up (assuming that my understanding of your question is correct): you need to identify in reliable and stable manner web elements your test code interacts with. If you are not supported by your developers (i.e. web elements do not have unique and stable identifiers for whatever reason) then you are on your own to find out a way to find those elements. This may be search by element's text, relative search (e.g. all DIVs two level down from current element), OCR, some heuristic (e.g. web element that is next to the right from the current one), etc. Actual implementation depends on your tested application and to provide a good enough suggestion one must have a possibility to investigate your application in the Object Browser.
- Largent8033 years agoContributor
The reason my developers is I have two website which are dynamic in their listings of the webelements dropdown list. So I can be using a name that is in both secured websites. Eventually, it will become one product but for now what I need is a way to test all the listings of these elements. This is why they won't name a specific element listing because at any point in time it could be someone else's name.
Also when working with the product it could start out belonging to one department and then two weeks later be changed to another department.
Also I am using xPath and CSS selectors. I have tried namemapping and that messed up both products testing.
- Largent8033 years agoContributor
My developers do support me. The issue is that these elements are dynamic in nature I could have a item with one of these elements at 12pm and by 3pm that element could will change to another individual or department. So the names and departments have to be very dynamic when they are setup.
Also the product will be merging with another website which we have which similar so everything has to be dynamic this includes individuals who things are assigned to as well as departments that it is going to.
Related Content
- 6 years ago
- 7 years ago
- 3 years ago