GPH Theory: Your Ultimate Guide to General Topics, News, SEO, and Technology

Welcome to GPH Theory, your go-to source for the latest news, insights, and analysis on general topics, SEO, technology, and more. Our mission is to provide you with the most relevant and up-to-date information to help you stay ahead of the curve. From beginners to experts, we have something for everyone. Join us and start your journey towards digital excellence today.

HOW TO SELECT LIST ITEMS FROM SPAN TAG SELENIUM| Element should have been "select" but was "span" SELENIUM

  Bittu      

SELECTION OF PARTICULAR MENU FROM DROP DOWN WITH SEARCH BOX SELENIUM


Facing Problem while selecting Menu from Drop down menu made from span tag with search box as an option. Below is the solution for the error Element should have been "select" but was "span".

Code After inspection of the Elements one after the other :

INSPECTING DROP DOWN MENU

 <span class="select2-chosen" id="select2-chosen-5">Select Status</span>

INSPECTING SEARCH BOX

 <input aria-activedescendant="select2-result-label-13" aria-autocomplete="list" aria-expanded="true" aria-owns="select2-results-5" autocapitalize="off" autocomplete="off" autocorrect="off" class="select2-input" id="s2id_autogen5_search" placeholder="" role="combobox" spellcheck="false" type="text" />

INSPECTING OPTION TO SELECT



SELENIUM CODE FOR SELECTION OF MENU FROM DROP DOWN LIST HAVING SEARCH BOX

WebElement click1=driver1.findElement(By.id("select2-chosen-5"));
click1.click();
WebElement statusList=driver1.findElement(By.id("s2id_autogen5_search"));
statusList.sendKeys("Lunch Out");
WebElement click2=driver1.findElement(By.className("select2-match"));
click2.click();
WebElement click3=driver1.findElement(By.id("subPunch"));
click3.click();


Implementation of above tag will resolve your issue and will automate your system.
logoblog

Thanks for reading HOW TO SELECT LIST ITEMS FROM SPAN TAG SELENIUM| Element should have been "select" but was "span" SELENIUM

Previous
« Prev Post

No comments:

Post a Comment