最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Katalon detecting auto complete dropdown choices - Stack Overflow

programmeradmin0浏览0评论

I am using Katalon 7.9.1 (yes, it's old and also not the enterprise edition but all I have to use, long story)

I have a popup that appears after clicking a button and there are several text fields in the new window. One is an autocomplete field where you see options from which to choose as you enter text. I can capture the XPath of the choice I want but it is dynamic so it will change and fail after the first use. Below is an example. I am not sure how to capture the element without XPath. When answering, if you don't mind, give me not just the code but the manual entry command. (Item = "click", Object = "Select_option" and the locator (//input[@something='something'] or //div[@class='something')

The element looks like this:

XPath - //*[@id="001OC0000074JaPYAU"]/div/span

Full XPath - /html/body/div4/div/div4/div/div/div/div/div4/div4/div/div4/section/div/div/div4/div/div/div4/ul/li[5]/div/span

Thanks so much in advance!

Here is an example:

I am using Katalon 7.9.1 (yes, it's old and also not the enterprise edition but all I have to use, long story)

I have a popup that appears after clicking a button and there are several text fields in the new window. One is an autocomplete field where you see options from which to choose as you enter text. I can capture the XPath of the choice I want but it is dynamic so it will change and fail after the first use. Below is an example. I am not sure how to capture the element without XPath. When answering, if you don't mind, give me not just the code but the manual entry command. (Item = "click", Object = "Select_option" and the locator (//input[@something='something'] or //div[@class='something')

The element looks like this:

XPath - //*[@id="001OC0000074JaPYAU"]/div/span

Full XPath - /html/body/div4/div/div4/div/div/div/div/div4/div4/div/div4/section/div/div/div4/div/div/div4/ul/li[5]/div/span

Thanks so much in advance!

Here is an example:

Share Improve this question asked Feb 2 at 18:18 Rob WRob W 311 silver badge3 bronze badges 1
  • 1 Share the URL or the html of the full page or at least a couple of levels higher with the element you want to select. – S A Commented Feb 5 at 8:10
Add a comment  | 

1 Answer 1

Reset to default 0

Since you have not given much detail about the page, Can't confirm if the selectors will work.

I'm guessing you are automating a salesforce lightning combobox element from the class of the span.

The best way to select the element would be by the text of the span.

//span[text()='American Samoa']

But this can find multiple elements with the same text. If it only finds one element, you can use this.

Or you can select the li element directly.

//li[.='American Samoa']

If there is only one country dropdown and the options has the optionName class then you can use,

//span[text()='American Samoa' and contains(@class,'optionName')]
发布评论

评论列表(0)

  1. 暂无评论