0

is it possible to detect in selenium, that new dynamic element added in html

msg_box = driver.find_element_by_class_name('_3u328')
 msg_box.send_keys('---')
 button = driver.find_element_by_class_name('_3M-N-')
 button.click()
asked Nov 17, 2019 at 4:33

2 Answers 2

2

If you know what element will be added you can use explicit wait with :

from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as ec
is_found = WebDriverWait(webdriver, time).until(ec.presence_of_element_located((by, locator)))

Small info on waits can be found here

answered Nov 18, 2019 at 12:10
0

You can find (in a loop) all elements which match your condition with find_elements_by_* getting the list of elements and check if the list is changed. If yes - that would mean new element was added.

Comparing previous list and new one you will detect which element exactly.

answered Nov 17, 2019 at 9:35

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.