如何访问TextView中的第二个链接?到目前为止我试过了:
AndroidElement d = (AndroidElement) driver.findElement(By.xpath("//android.widget.TextView[@text='Notice']"));
d.click();
使用:
driver.findElement(By.Id("com.optimum.rdvr.mobile:id/toc_text"));
只需点击第一个链接即可。我需要得到第二个链接。我想点击“移动隐私声明”任何人都有建议吗?
答案 0 :(得分:0)
您可以使用Linkify
String termsOfUse = getResources().getString(R.string.terms_of_use);
String privacyNotice = getResources().getString(R.string.privacy_notice);
legalDescription.setText(
String.format(
getResources().getString(R.string.message),
termsOfUse,
privacyNotice )
);
//add the links
Pattern privacyNoticeMatcher = Pattern.compile(privacyNotice);
Linkify.addLinks(legalDescription, privacyNoticeMatcher , "privacy:");
Pattern termsOfUseMatcher = Pattern.compile(termsOfUse);
Linkify.addLinks(legalDescription, termsOfUseMatcher , "termsOfUse:");