Thanks for covering it. In utility function, better to pass By locator and String option (that needs to be clicked) and let the function create the List. TestClass/main() method just needs to maintain the By locators. public static void Search(By searchField, By suggestions, String searchKey, String suggName) { driver.findElement(searchField).sendKeys(searchKey); List suggList = driver.findElements(suggestions); System.out.println(suggList.size()); for (WebElement e : suggList) { String text = e.getText(); System.out.println(text); if (text.contains(suggName)) { e.click(); break; } } }
@Mukeshotwani4 ай бұрын
Thank you Naveen bhai, yes it was quick video so could not add all variations. We can overload this methods with different signature.
@naveenautomationlabs4 ай бұрын
@@Mukeshotwani awesome video bhai :)
@Mukeshotwani4 ай бұрын
@@naveenautomationlabs thank you sir ji complement from you made my day ♥️
@anouarchouikh23054 ай бұрын
The best teacher ever! thank you for all what you do for the community Mukesh!
@Mukeshotwani4 ай бұрын
So nice of you Anouar. it means alot to me.
@nayabshaik22822 ай бұрын
Last week, I searched for the same functionality, and I went through Naveen Bhai's video. I found it a bit difficult to write XPath for findelements. Somehow, I have completed work, but today, you made my life easy, Mukesh. You showed how simple we can write the XPath.
@Mukeshotwani2 ай бұрын
Glad it helped Nayab bhai. Keep Learning.
@gnaneswararaodamodara18344 ай бұрын
Thank you 👍 Mukesh for making useful videos😊 and you are the one of my fav tutor ❤️....
@Mukeshotwani4 ай бұрын
Thank you so much Gnanesswararao 🙏🙏🙏 Keep watching and keep supporting 😇
@Nameskar4 ай бұрын
Very very thank you. Taking time adding this video very helpful.
@Mukeshotwani4 ай бұрын
You are welcome! dear
@sonalagrawal15064 ай бұрын
Very helpful video..thankyou mukesh!!
@Mukeshotwani4 ай бұрын
@@sonalagrawal1506 most welcome Sonal 🙏 I am glad it helped
@RajibLama4 ай бұрын
Thanks Mukesh.
@Mukeshotwani4 ай бұрын
Most welcome Rajib
@97457549044 ай бұрын
For search functionality automation, if data is not found it will throw nosuchelementexception ,so do we need to handle it and how?
@Mukeshotwani4 ай бұрын
Hi Jino, you can add 1 extra check if list size is 0 then dont execute. FindElements will always returns List no exception. kzbin.info/www/bejne/jYGmqaCIirtod5I
@97457549044 ай бұрын
Thanks @Mukeshotwani😊,i had a functionality developed long back of adding a data with multiple fields in application.i created positive and negative test cases for those fields but once it was stable,i created a regression test case having a positive flow.But recently a prod issue came where user entered a negative data and didnt get the validation errror,Since negative testing we wont cover as a regression test case and it was missed in every regression cycle.So how to handle such scenarios?
@vipulpatil91513 ай бұрын
I am facing an issue where, after inputting eg-'Mukesh Otwani' in the search bar, the auto-suggestion dropdown disappears during inspection, making it difficult to capture the XPath for dynamic suggestions.what is the solution for that
@Mukeshotwani3 ай бұрын
Hi Vipul, you can use debugger for the same. You can also use Selectorshub which can enable debugger. Here is the quick video for the same kzbin.info/www/bejne/jXnSdX2Xist9rtk