Any selenium python expert i have a error i can't fix it

Jacke met

Regular Member
Joined
Feb 13, 2022
Messages
282
Reaction score
107
its a button that i want to upload a video to
the_upload = driver.find_element(By.XPATH, '//*[@id="mount_0_0_Kt"]/div/div/div/div[2]/div/div/div[1]/div/div[3]/div/div/div/div/div[2]/div/div/div/div[2]/div[1]/div/div/div[2]/div/button')
the_upload.send_keys(video_path)
time.sleep(7)
any suggestion to fix this
 
You are only sending the path according to your code, you have to click the button afterwards.
 
because the browser tab close and show error in this line (of the path)
 
So the code you provided, attempts to locate a button element on the page using the specific XPATH expression . If the element is found, it will be stored in the variable button_of_reels. This button element can then be interacted with using various Selenium methods, such as click() method to click on it. Still dont see the problem.
 
its a button that i want to upload a video to

any suggestion to fix this
is the element not being detected?

you could do a wait for element

You have to import these
from selenium.webdriver.support import expected_conditions as EC

then

wait.until(EC.visibility_of_element_located((By.XPATH, 'YOUR XPATH HERE')))



if not it could be dynamic or just xpath sometimes bugs for me, i had that happen.

but if its a drag and drop upload you have to use an entire different type of approach
you need to give us more information to help with your error.
 
You have posted your code but not the error that you are getting for the same. If it's because the browser exits before the elements are loaded, then you have to use this to wait for the element to load.
 
is the element not being detected?

you could do a wait for element

You have to import these
from selenium.webdriver.support import expected_conditions as EC

then

wait.until(EC.visibility_of_element_located((By.XPATH, 'YOUR XPATH HERE')))



if not it could be dynamic or just xpath sometimes bugs for me, i had that happen.

but if its a drag and drop upload you have to use an entire different type of approach
you need to give us more information to help with your error.
yes the element xpath not located to use the send key method to upload a video to the site
 
Back
Top