简体   繁体   中英

How to click element under <a href> link using Selenium java

HTML code

using Selenium + Java. I need to click the filter button.

Currently, I am using below code but it doen't work.

WebElement filter = driver.findElement(By.linkText("Filter"));
filter.click();

Xpath - //*@id="frmBookingListing"]/div[3]/div 1 /div[3]/div/div 1 /div/div[2]/a[2]

cssSelector -.searchFilter

I don't know what's wrong with my code. please help to click on filter button. Thanks in advance.

Try this:

.//a[@class='btn btn-typ4 searchFilter' and @title='Filter']/span

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM