Gourav
Gourav

Reputation: 1

Selenium in java unable to identify classname

Selenium webdriver is not able to identify this element by 'classname' as it has spaces .I cannot use 'name' as it has multiple element with same name.

<span id="Fn14906146202366285507890WSRP:TransactionHistoryFG.OUTFORMATSelectBoxIt" tabindex="0" class="selectboxit dropdownexpandalbe selectboxit-btn" name="TransactionHistoryFG.OUTFORMAT" unselectable="on" role="combobox" aria-autocomplete="list" aria-expanded="false" aria-owns="Fn14906146202366285507890WSRP:TransactionHistoryFG.OUTFORMATSelectBoxItOptions" aria-activedescendant="3" aria-label="Display Format" aria-live="assertive"><span id="Fn14906146202366285507890WSRP:TransactionHistoryFG.OUTFORMATSelectBoxItText" class="selectboxit-text" unselectable="on" data-val="2" style="max-width: 120px;">On Screen</span><span id="Fn14906146202366285507890WSRP:TransactionHistoryFG.OUTFORMATSelectBoxItArrowContainer" class="selectboxit-arrow-container" unselectable="on"><i id="Fn14906146202366285507890WSRP:TransactionHistoryFG.OUTFORMATSelectBoxItArrow" class="selectboxit-arrow selectboxit-default-arrow" unselectable="on"></i></span></span>

Upvotes: 0

Views: 50

Answers (1)

alecxe
alecxe

Reputation: 473893

Don't worry about the spaces, you can check multiple classes in a CSS selector:

driver.findElement(By.cssSelector(".selectboxit.dropdownexpandalbe.selectboxit-btn"))

Or, you can also just check a single class:

driver.findElement(By.cssSelector(".selectboxit"))
driver.findElement(By.className("selectboxit"))

Upvotes: 1

Related Questions