How can I resolve this error - compound class names not permitted?

1.0K    Asked by ankurDwivedi in QA Testing , Asked on May 6, 2022

Software Quality Assurance & Testing

Selenium vba XPath/css Element not found for

Asked 1 year, 11 months ago

Active 1 year, 11 months ago

Viewed 2k times

-1 I need help!

I'm trying to connect to this Webpage and interact with it via WebDriver. I managed to open the page but when I'm trying to interact I get this error. I tried to press this Link/Button which has the class "afpaas-quick-link ng-scope afpaas-condition-mobile-display"

and this was my code:

b = "afpaas-quick-link ng-scope afpaas-condition-mobile-display"

'obj.FindElementByClass(b).Click

Here I get the error "compound class names not permitted" so I checked google and the answer was Xpath/Css

I was able to get the CSS/Xpath via Chrome Inspector. Here are the two paths

body > div > div.afpaas-body > div > div.afpaas-sidebar.afpaas-sidebar--hide > div.afpaas-quick-links-container > div > a:nth-child(2)
'/html/body/div/div[3]/div/div[1]/div[3]/div/a[2]
I tried both but I get the error No Such Element found.... Why? What am I doing wrong?

The code I tried is

obj.FindElementByCss("body > div > div.afpaas-body > div > div.afpaas-sidebar.afpaas-sidebar--hide > div.afpaas-quick-links-container > div > a:nth-child(2)").Click

obj.FindElementByXPath("/html/body/div/div[3]/div/div[1]/div[3]/div/a[2]").Click Here is more of the page code Schnellzugriff Neue Überwei

<!-- end ngRepeat: quickLink in quickLinkItem.quickLinks -->
Answered by Anil Jha
Try using

//a[contains(@href,"q1_new-trading-order")]
To resolve the error - compound class names not permitted

Your Answer

Interviews

Parent Categories