1

I can't focus on upload button to upload resume.

<div id="uploadCredential" campaignid="6ecdba81-5485-11e8-8fbf-bc764e1156ea" class="                                                              ">
   <a href="#">
     <i class="icon-laptop"></i>
      Upload Resume
     </a>
</div>

URL: Website Link

cruisepandey
  • 28,520
  • 6
  • 20
  • 38
bhupathi turaga
  • 297
  • 2
  • 16

2 Answers2

2

As per the HTML you have shared the element with text as Upload Resume is within the <a> tag and to click on the element you can use either of the following Locator Strategies :

  • link_text :

    driver.find_elements_by_link_text("Upload Resume").click()
    
  • css_selector :

    driver.find_element_by_css_selector("div#uploadCredential > a").click()
    
  • xpath :

    driver.find_element_by_xpath("//div[@id='uploadCredential']/a").click()
    
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
1

Use this code :

driver.find_elements_by_link_text("Upload Resume").click()
cruisepandey
  • 28,520
  • 6
  • 20
  • 38
  • just clicking on it not uploading Resume i used this code **driver.find_elements_by_link_text("Upload Resume").send_keys("C:/Users/user/Desktop/Resume.docx")** – bhupathi turaga May 11 '18 at 08:21
  • for uploading you might wanna use AutoIT script . – cruisepandey May 11 '18 at 08:22
  • how to use without autoit – bhupathi turaga May 11 '18 at 08:27
  • You are clicking on a upload resume button , that button is a webelement , selenium can interact with it ! However, after clicking you must have seen the native window which selenium can’t interact with. You will have to go for 3rd party application like AutoIT. Still if you do not want to go with AutoIT you can use ROBOT class for the same. Note that robot class is highly unstable as compared to AutoIT – cruisepandey May 11 '18 at 08:33
  • If you have GTK, then you can use the gtk.gdk.Display class to do most of the work. It controls the keyboard/mouse pointer grabs a set of gtk.gdk.Screen objects. – cruisepandey May 11 '18 at 08:38
  • Check out this SO :https://stackoverflow.com/questions/860013/is-there-a-python-equivalent-to-javas-awt-robot-class?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa and This SO : https://stackoverflow.com/questions/69645/take-a-screenshot-via-a-python-script-linux/782768#782768 – cruisepandey May 11 '18 at 08:39
  • i am pyperclip for copy and paste coverletter – bhupathi turaga May 11 '18 at 09:07
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/170889/discussion-between-bhupathi-turaga-and-cruisepandey). – bhupathi turaga May 12 '18 at 03:53
  • @bhupathituraga : Sure ! – cruisepandey May 12 '18 at 15:02