Is'haq
Is'haq

Reputation: 184

Click on a tab element inside a webpage is not working

I have been trying to click an element in a webpage by using this code

var testset = driver.FindElements(By.PartialLinkText("Reversal Detail Overview")) ;
testset[0].Click();

But when I am trying to click the element using the exact text shown in the Jscript of the page it is clicking some other element(Yellow color in the picture) inside the active tab but not the seperate tab(Green color in the picture)

enter image description here

when debugging I am getting the correct tag name of the another TAB

enter image description here

Not sure where I am going wrong. Can anyone please help me to click on the reversal detail overview tab control that is highlighted in green. Thanks in advance.

Upvotes: 2

Views: 54

Answers (1)

cruisepandey
cruisepandey

Reputation: 29362

any specific reason why are you PartialLinkText and findElements ?

Did you try this instead :

var testset = driver.FindElement(By.LinkText("Reversal Detail Overview")) ;
testset.Click();

if not this, you may even try this :

var testset = driver.FindElement(By.CssSelector("li a[href*='#reversal_detail_overview']")) ;
testset.Click();

Upvotes: 1

Related Questions