Questions tagged [findby]

FindBy is a type of annotation used to mark a field on a Page Object to indicate an alternative mechanism for locating the element or a list of elements. Used in conjunction with PageFactory this allows users to quickly and easily create PageObjects.

FindBy is a type of annotation used to mark a field on a Page Object to indicate an alternative mechanism for locating the element or a list of elements. Used in conjunction with PageFactory this allows users to quickly and easily create PageObjects.

You can either use this annotation by specifying both "how" and "using" or by specifying one of the location strategies (eg: "id") with an appropriate value to use. Both options will delegate down to the matching By methods in By class.

For example, these two annotations point to the same element:

@FindBy(id = "foobar") WebElement foobar;
@FindBy(how = How.ID, using = "foobar") WebElement foobar;

and these two annotations point to the same list of elements:

@FindBy(tagName = "a") List<WebElement> links;
@FindBy(how = How.TAG_NAME, using = "a") List<WebElement> links;
155 questions
2
votes
2 answers

Selenium Java handle object(alert dialog) exception without delaying. (unpredictable Java pop-up)

Goal: alert pop up. whether it's shown or not, I want it to continue. if it shows, have to select the checkbox, and hit continue. if not, ignore. Blocker: if alert shows, it will handle the action and dialog will be closed. but when it's not,…
2
votes
1 answer

JPA findBy(Property) return null

I have written JPA code in Spring boot where I want to perform CRUD and other operations on an Entity, I have written RecipeRepository that extends JpaRepository public interface RecipeRepository extends JpaRepository { public…
Adnan Mian
  • 415
  • 1
  • 5
  • 17
2
votes
1 answer

Ember Store: Sort, Filter, Find Records

I load records into my store in the index route: model: function(){ return Ember.RSVP.hash({ cars: this.store.query('car',{}).then(function(data){ }) }); } I then go to my car route to peekAll (no network request) and get…
Matt
  • 1,811
  • 1
  • 19
  • 30
2
votes
3 answers

How to use Wait.Until with Selenium if I already have the element with FindsBy

I am using Wait.Until method to check if my page is already loaded or if it still loading . This is how it looks like : protected IWebElement FindElement(By by, int timeoutInSeconds) { StackTrace stackTrace = new StackTrace(); …
Daria Shalimov
  • 131
  • 1
  • 1
  • 8
2
votes
0 answers

findBy to search inside an array in MongoRepository

I have a Mongo document which is like this : db.user.find() { "_id" : ObjectId("560fa0c730a8e74bbd69c094"), "name" : "abc", "employee" : [{ "_id" : BinData(3,"v0m0V46pok94fVfwGkFVig=="), …
GareGarble
  • 285
  • 1
  • 3
  • 9
2
votes
2 answers

FindBy: How + using vs. name of location strategy

Using Selenium WebDriver, when annotating your Locators with @FindBy you can choose between a combination of How + using: @FindBy(how = How.ID, using = "foobar") WebElement foobar; or you can directly use the location strategy like so: @FindBy(id =…
drkthng
  • 6,651
  • 7
  • 33
  • 53
2
votes
2 answers

I get java.lang.NullPointerException at @FindBy WebDriver

i'm new in Selenium WebDriver, i'm trying to create some tests, but everytime when i use @FindBy in my test is not working( java.lang.NullPointerException), instead, if i use findElement, is work fine. Error: java.lang.NullPointerException at…
Unity
  • 31
  • 1
  • 4
2
votes
1 answer

Using @FindBy with my own class, not with WebElement

Is it possible to use @FindBy not only with WebElement, but with my own class? I would like to have my class for cooperating with page elements and to override some methods of WebElement interface in it. So that I implemented the class: public…
2
votes
1 answer

Symfony2 findBy method with property from relationship

I'm wondering if it's possible to querying doctrine entities by a property from a relation. Here is an example : Entity A fields : -> title -> content -> description -> date Entity B fields : -> title -> link ( entity b ) -> date Is it…
Charles-Antoine Fournel
  • 1,713
  • 1
  • 25
  • 37
2
votes
1 answer

How to get from a WebElement the Findby type and string

How can I get the Findby type and string from a WebElement? I am using a self-built webDriverWait function that will be able to receive By Or Webelement to be used at the presenceOfElementLocated() function. Defining the WebElement @FindBy(xpath =…
Shilon
  • 21
  • 2
2
votes
1 answer

@FindBy doesn't care if the element isn't there when I call initElements

For instance, let's say I have class FanPage, with this annotation @FindBy(how = How.ID, using = "ctl00__lvph_Add") private WebElement _AddFanButton; and then in my test code I say fanPage = homePage.GoToFanPage() which does return…
techgnosis
  • 1,879
  • 2
  • 17
  • 19
2
votes
3 answers

Symfony2 - FOSUserBundle - FindUserBy

I´ve created my own user Bundle, extending FOSUserBundle. In my UserBundle, I have a memberID field, with its setters and getters. I can already find users by memberID using EntityManager, and then I could find the user through UserManager matching…
Xavi
  • 1,555
  • 2
  • 13
  • 15
2
votes
1 answer

Doctrine2 findby on a Many-to-One mapping

I have two entities with a Unidirectional Many-to-One mapping. Here's Product: use Doctrine\Common\Collections\ArrayCollection; /** * @Entity * @Table(name="Product") *…
Michael De Keyser
  • 787
  • 1
  • 17
  • 45
1
vote
1 answer

Rails 3- find_by not working

I have a strange problem. I have two models Users and roles with a many to many relationships between them. I want to filter the roles with name 'Administrator' within the role collection of a user. In the model this code puts…
Tony
  • 10,088
  • 20
  • 85
  • 139
1
vote
1 answer

FindByObject returns null even when record is in the db

In a springboot application I create a Game, with a list-of-cards converted in a large String. The Game is related to a Player. When I try to lookup the Game for a Player, the Springboot Hibernate app returns NULL . Why??!?? Now I want to create an…
M.Koops
  • 145
  • 1
  • 15
1 2
3
10 11