How to find a element after a search click checkbox in selenium Python

2024/11/19 20:43:44

After I search for a user in the search field, I get the user I searched Now I need to select this user that shown in the list

I tried with xpath and did not find the element ! could you help ?

So after I search for that user I need to click the first result checkbox

HTML Element code

Website screenshot

what I tried:

self.browser.find_element_by_xpath("/html[1]/body[1]/div[1]/div[4]/main[1]/div[3]/div[2]/section[3]/div[1]/div[2]/div[4]/div[2]/div[1]/div[1]/div[2]/div[1]/div[2]/div[2]/div[1]/div[3]/div[2]/div[2]/div[2]/div[1]/div[2]/div[1]/div[1]/div[1]/div[1]/div[2]/div[2]/div[1]/table[1]/tbody[1]/tr[1]").click()WebDriverWait(self.browser, 10).until(EC.visibility_of_element_located((By.XPATH, "//div[contains(@class,'azc-grid-cellContent') and(contains(text(),'{}'))]".format(email)))).click()

Edit: Added a new photo

enter image description here

Answer

In case you need to click on the first presented result please try this:

WebDriverWait(self.browser, 10).until(EC.visibility_of_element_located((By.XPATH, "//tr[@aria-rowindex='1']//div[@data-bind]"))).click()

I'm not sure about this.
Need to see the actual web page with the dev tools for better suggestion...

https://en.xdnf.cn/q/118499.html

Related Q&A

Running parameterized queries

Quite new to this google bigquery sql thing so please bear with me. Im trying to build a google standardSQL parameterized query. The following sample was used and ran successfully on Google BigQuery We…

how to do this disparity map in OpenCV

paper "Fast Obstacle Detection Using U-Disparity Maps with Stereo Vision"reference paper: "Fast Obstacle Detection Using U-Disparity Maps with Stereo Vision"I want to ask can opencv…

How do I give out a role when I click on a reaction? It doesnt work for me?

Im trying to make sure that when you enter a command, a message is sent and a reaction is set, and those who click on the reaction get a role, but when you enter a command, nothing happens. Here is the…

Python Pandas DataFrame Rounding of big fraction values [closed]

Closed. This question needs debugging details. It is not currently accepting answers.Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to repro…

Splitting Data in Python?

it does not work. I want to split data as in code in lines attribute. class movie_analyzer:def __init__(self,s):for c in punctuation:import removiefile = open(s, encoding = "latin-1")movielis…

Use local function variable inside loop [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.Want to improve this question? Add details and clarify the problem by editing this post.Closed 7 years ago.Improve…

Groupby Pandas , calculate multiple columns based on date difference

I have a pandas dataframe shown below: CID RefID Date Group MID 100 1 1/01/2021 A 100 2 3/01/2021 A 100 3 4/01/20…

EC2 .bashrc and .bash_profile re-setting

Reason Im asking: pycurl requires both libcurl-devel and openssl-devel. To install these, I have these two lines the my .bash_profile: sudo yum install libcurl-devel sudo yum install -y openssl-develPr…

How to load mutiple PPM files present in a folder as single Numpy ndarray?

The following Python code creates list of numpy array. I want to load by data sets as a numpy array that has dimension K x M x N x 3 , where K is the index of the image and M x N x 3 is the dimension …

Python: Understanding Threading Module

While learning Pythons threading module Ive run a simple test. Interesting that the threads are running sequentially and not parallel. Is it possible to modify this test code so a program executes the …