November 15, 2017

Need help with a selenium bot

So i’m trying to build a bot that will automatic sign me in for appartments that everyday at 20:00PM are published on the site. You have different types of assigning an appartment. The one I need is called ‘Direct kans’. At this one the first one that reacts to the appartment gets the appartment.
[Image: 9]

The one called ‘Direct kans’ is the one I need to get clicked. I made the bot click the first one listed, but I want him to search for the text first and then click the element. It’s about this line of code, I tried to do it with xpath but didnt succeed.

Code:
#Ga naar aanbod

#klikken op advertentie
block2 = browser.find_element_by_class_name('js-animate-fadein')
block2.click()

He now is clicking on the element with class name ‘js-animate-fadein’. But since all the advertisements have that same class, he is just clicking the first one he finds.

I inspected the site and found that the ‘Direct kans’ text is deeply nested into alot of divs. I really have no clue how to make the bot find the first element out of all the different elements. This is the website: https://www.woonnetrijnmond.nl/ 

If anyone can take a look at the HTML of the site and tell me how to get the first element with the text ‘Direct kans’, it would be really appreciated! 

I’m sorry for my bad english.

Category : Uncategorized

Leave a Reply

Your email address will not be published. Required fields are marked *

November 15, 2017

Need help with a selenium bot

So i’m trying to build a bot that will automatic sign me in for appartments that everyday at 20:00PM are published on the site. You have different types of assigning an appartment. The one I need is called ‘Direct kans’. At this one the first one that reacts to the appartment gets the appartment.
[Image: 9]

The one called ‘Direct kans’ is the one I need to get clicked. I made the bot click the first one listed, but I want him to search for the text first and then click the element. It’s about this line of code, I tried to do it with xpath but didnt succeed.

Code:
#Ga naar aanbod

#klikken op advertentie
block2 = browser.find_element_by_class_name('js-animate-fadein')
block2.click()

He now is clicking on the element with class name ‘js-animate-fadein’. But since all the advertisements have that same class, he is just clicking the first one he finds.

I inspected the site and found that the ‘Direct kans’ text is deeply nested into alot of divs. I really have no clue how to make the bot find the first element out of all the different elements. This is the website: https://www.woonnetrijnmond.nl/ 

If anyone can take a look at the HTML of the site and tell me how to get the first element with the text ‘Direct kans’, it would be really appreciated! 

I’m sorry for my bad english.

Category : Uncategorized

Leave a Reply

Your email address will not be published. Required fields are marked *

Proudly powered by Bolkya Resha and Software Testing Theme