要找到国家首都的X路径,但使用国家X路径

问题描述 投票:0回答:1

大家好,我想通过国家找到该国首都的X路径。请帮我找到X路径。我使用了独立和依赖的X路径,但找不到它。

网站链接 - https://www.countries-ofthe-world.com/capitals-of-the-world.html

我尝试使用国家名称找到城市的X路径。 在此输入图片描述

selenium-webdriver automation selenium-chromedriver automated-tests
1个回答
0
投票
//table//td[text()='Mali']/following-sibling::td

您可以根据您使用的编程语言使用变量替换国家/地区。这样,当您传递国家/地区名称时,该 xpath 将指向该国家/地区的首都

© www.soinside.com 2019 - 2024. All rights reserved.