Reputation: 139
Here is my code:
<div class="meal_buton_cont">
<button class="pink_button" data-target="#myModal" data-toggle="modal">Add Selected to Shopping List</button>
<button id="add_meal" class="gray_button">+ Add Meal</button>
</div>
I am using this:
driver.findElement(By.className("pink_button")).click();
But no popup open but some time open but not item take, it show blank.
How to create script for clicking Pink_button
then my popup will be open?
Please help me
Upvotes: 1
Views: 446
Reputation: 4683
Few things to consider..Wait before the element appears using explicit waits like WebDriverWait
API. Once the element is clickable using ExpectedConditions.elementToBeclickable(WebElement)
then click on it and again wait till the pop-up appears. if its alert then use ExpectedConditions.alsertIsPresent()
with WebDriverWait
Upvotes: 1