Can't find an element Using Selenium

0 votes

My code is:

browser = webdriver.Chrome()
wait = WebDriverWait(browser, 10)
data = wait.until(EC.element_to_be_clickable((By.CSS_SELECTOR, '#search_result_former > div.re-content.search-mode-content > div.list-container > ul > li:nth-child(1) > div > div.item-footer > div > a:nth-child(1)')))

The HTML is:

<div class="btn-group clear">
                        <a href="javascript:;" class="btn btn-operation" role="detail">详览</a>
                        <a href="javascript:;" class="btn btn-operation" role="lawState" an="CN201820052763" pn="CN207117855U">法律状态</a>
                        <a href="javascript:;" class="btn btn-operation" role="proposor" _name="信阳农林学院;" _address=" 河南省信阳市羊山新区新24大街信阳农林学院;" _zipcode="464000;" _country="">申请人</a>
                        <a href="javascript:;" role="addAnalysis" class="btn btn-operation">+ 分析库</a>
                        <a href="javascript:;" role="favorite" class="btn btn-operation">收藏</a>
                        <a href="javascript:;" role="translate" _id="CN201820052763.420180316XX" class="btn btn-operation btn-translate">翻译</a>
                        </div>

The result after I run my code:

*raise TimeoutException(message, screen, stacktrace)
selenium.common.exceptions.TimeoutException: Message:* 

Actually, I can see the element. I mean, the element has been loaded. I have tried XPATH, but it doesn't work.

Mar 26, 2018 in Selenium by Shubham
• 12,270 points
182 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

The reason you can't locate the item is because a new window is opened and I need to switch to the new one. 

windows = browser.window_handle browser.switch_to.window(windows[-1])

Do let me know if this works!

answered Mar 26, 2018 by nsv999
• 5,030 points

Related Questions In Selenium

0 votes
1 answer

Locating an element by value using css selector using Selenium WebDriver

Below code will help By.cssSelector("td[class='someclass'][value='u ...READ MORE

answered Apr 9, 2018 in Selenium by coldcode
• 1,980 points
57 views
0 votes
1 answer
0 votes
1 answer

Wait for an element to be accessible using Selenium WebDriver

You can try out the below code: ...READ MORE

answered May 18, 2018 in Selenium by Atul
• 10,200 points
68 views
0 votes
1 answer

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,030 points
66 views
0 votes
1 answer
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,130 points
438 views
0 votes
1 answer

How to use such xpath to find web elements

It's much simpler to use: #MyDiv123 > div.super or ...READ MORE

answered Jun 14, 2018 in Selenium by Samarpit
• 5,130 points
52 views
0 votes
1 answer

Finding an element in Selenium

Basically, they are not too different. The ...READ MORE

answered Mar 27, 2018 in Selenium by nsv999
• 5,030 points
64 views
0 votes
1 answer

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.