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
57
votes
4 answers

Doctrine findBy with OR condition

Is it possible to use OR statement in Doctrine findBy() method? I know that given array is interpreted as case1 AND case2... Like this $this->repos['notif']->findBy(array('status' => 1, 'status' => 2, 'status' => 3); Stands for SELECT * FROM…
ArVan
  • 4,225
  • 8
  • 36
  • 58
38
votes
4 answers

spring data - Mongodb - findBy Method for nested objects

I have two domain objects, @Document public class PracticeQuestion { private int userId; private List questions; // Getters and setters } @Document public class Question { private int questionID; private String…
user1720083
  • 381
  • 1
  • 3
  • 3
37
votes
7 answers

Selenium @FindBy vs driver.findElement()

Why should I use @FindBy vs driver.findElement()? @FindBy forces me to move all my variables to a class level (when most of them only need to be at the method level). The only thing it seems to buy me is I can call PageFactory.initElements(), which…
18
votes
1 answer

how to use spring data example matcher for list attribute - query issue

I would like to ask how to use exampleMatcher for class with List attribute. Lets assume, we have a user which can have multiple roles at the same time. I want to get all users with user role from DB entities @Entity(name = "UserEntity") public…
smeidak
  • 285
  • 1
  • 3
  • 13
12
votes
4 answers

What is the use of Annotation "@FindBy"?

Can anyone explain me about Annotation @FindBy in WebDriver? Where and why it is used?
mra419
  • 413
  • 4
  • 9
  • 23
8
votes
0 answers

Doctrine 2: Find entity using entity relations

I have 3 entities: Style Colour Article An article has a ManyToOne relationship with both entities (an article is a unique combination of style and colour). All entities have auto incrementing surrogate integer indexes. I have a Style Entity, and a…
calumbrodie
  • 4,722
  • 5
  • 35
  • 63
8
votes
1 answer

Doctrine: IN-Operator in entity-repository's findBy?

I want to make a findBy in doctrine with the IN-Operator, like in SQL: ...WHERE column_name IN (value1,value2,...); Is it possible to do this in the criteria array of the entity-repository's findBy? this->entityRepository->findBy($criteria,…
Zwen2012
  • 3,360
  • 9
  • 40
  • 67
7
votes
4 answers

doctrine findby magic null value

I'm wondering if there is anyway to use doctrine's magic method to look for null values. For instance: Doctrine::getTable('myClass')->findByDeletedAt(null); Essentially, I want to return all records that are not deleted. I've tried the above, but…
Sean
  • 91
  • 1
  • 1
  • 3
7
votes
1 answer

MongoRepository findByCreatedAtBetween not returning accurate results

My document structure in Mongo is like this : db.user.find() { "_id" : ObjectId("560fa46930a8e74be720009a"), "createdAt" : ISODate("2015-10-03T09:47:56.333Z"), "message" : "welcome", } { "_id" :…
GareGarble
  • 285
  • 1
  • 3
  • 9
6
votes
2 answers

JPA findBy method always goes to orElseThrow

This is our code private IdentificationMaster validateIdentificationType(String idType) { if(!StringUtils.isNotBlank(idType)) throw new IllegalArgumentException("Invalid idType"); Optional op1 =…
Arun Sudhakaran
  • 2,167
  • 4
  • 27
  • 52
4
votes
1 answer

doctrine 2 findby function , get keys and values

can i get the keys and values dynamically. in php, you would: foreach ($array as $key => $value) but you can do this for : $this->_em->getRepository('Members')->findBy(array('id' =>5)); any way to get the keys from this with their values..? i can…
dean jase
  • 1,161
  • 5
  • 23
  • 38
3
votes
2 answers

Does Grails has domain.find-by... option ":select" to limit column like rails?

In rails,we can use Order.find(:all,:select=>"id,name...... or Order.where(....).select("id,name") to limit the column. But i can not find the similar way in Grails. so can you give me some help for it? thanks.
3
votes
1 answer

AndroidFindBy ID or XPATH

Wondering if this is possible. We have our RC that has no ID for an XML layout element. In our Develop branch we add ID to the layout but haven't pulled it in yet. For AndroidFindBycan I use XPATH for RC and ID for Develop? @AndroidFindBy(id =…
JPM
  • 9,077
  • 13
  • 78
  • 137
3
votes
1 answer

How to get List of Objects with value in array in Spring-Boot CrudRepository

I have an Object defined that has ChildAccountList of Strings as one of the attributes. Is there a findBy method that I can use such that it will return the list of all rows where one of the elements in the array equals the passed in parameter. I…
adbdkb
  • 1,897
  • 6
  • 37
  • 66
3
votes
1 answer

Can I use IN and findBy together in Groovy and Grails?

I've been trying to figure out how to do something like SELECT * FROM domain WHERE config_id IN (1, 2, 3) when using the nice findBy technique of Grails. Haven't really figured out how yet though, is it even possible? I was hoping for something…
Lars Andren
  • 8,601
  • 7
  • 41
  • 56
1
2 3
10 11