Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Questing regarding ajax pull #79

Open
akrambek opened this issue Apr 16, 2015 · 5 comments
Open

Questing regarding ajax pull #79

akrambek opened this issue Apr 16, 2015 · 5 comments

Comments

@akrambek
Copy link

Hi there,

I am trying to create a block for bootsrap select2 element. Here is my code.

@Name("Select2")
public class Select2DropDownList extends HtmlElement {

    @FindBy(className = "select2-choice")
    Link selectLink;

    @FindBy(xpath = "//*[@id='select2-drop']/div/input")
    TextInput searchTextInput;

    @FindBy(xpath = "//*[@id='select2-drop']/ul")
    Ul selectResult;

    public void selectOptionThatContains(String value) {
        selectLink.click();
        searchTextInput.clear();
        searchTextInput.sendKeys(value);
        selectResult.selectOptionThatContains(value);
    }
}

The problem I am facing is that once searchTextInput.sendKeys(value) is being called it is taking sometime for result to appear. So how can I add wait after searchTextInput.sendKeys(value). Any example? Thank you in advance.

@aik099
Copy link
Contributor

aik099 commented Apr 16, 2015

I'm not sure if there is native wait function that would periodically (several times in a second) check if element if present and when it will be present will call some action on it.

@akrambek
Copy link
Author

Because I can't even use Thread.Sleep. How about AjaxElementLocator.

@aik099
Copy link
Contributor

aik099 commented Apr 17, 2015

Isn't AjaxElementLocator used by default. So, when searching for searchResult it should wait for 5 seconds before giving up and throwing an error.

@akrambek
Copy link
Author

Actually, htmlelements works as expected it was how select option was working. I put full xpath and it worked. Thanks for your help.

@ham1
Copy link
Contributor

ham1 commented Jun 10, 2016

@akrambek could you post the full xpath here in case others find it useful, then can this issue be closed?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants