Python Forum
Unable to click element in web page
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Unable to click element in web page
#1
Hello All,

I am trying to use python code for dynamic element where after login into URL I need to click element which is not happening with the below code.

from selenium import webdriver
from selenium.webdriver.common.by import By
import time
from selenium.webdriver.common.keys import Keys
from docx import Document
from docx.shared import Inches
from selenium.webdriver.common.action_chains import ActionChains

driver = webdriver.Firefox()
driver.get("URL")
#time.sleep(40)
driver.implicitly_wait(30)

iframe = driver.find_elements_by_tag_name('frame')[0]
driver.switch_to.frame(iframe)
driver.implicitly_wait(30)
#This is dummy login
username = driver.find_element_by_id("abc")
username.send_keys("admin")
#This will input username & password
username = driver.find_element_by_id("abc")
username.send_keys("admin")

password = driver.find_element_by_id("www")
password.send_keys("abc")

driver.find_element_by_id("bpm.Logon.1.btnLogon").click()
driver.switch_to.default_content()

time.sleep(20)

#switching between the iframes based on index

iframe = driver.find_elements_by_tag_name('frame')[0]
driver.switch_to.frame(iframe)

navigate = driver.find_element_by_id("bpm.mnit_Nav")
actions = ActionChains(driver) # initialize ActionChain object
actions.move_to_element(navigate)

time.sleep(10)

Administer = driver.find_element_by_xpath("//html/body/div[9]/div[1]/table/tbody/tr[7]/td[2]")
actions = ActionChains(driver) # initialize ActionChain object
actions.move_to_element(Administer).click().perform()

time.sleep(10)

[b]applicationLibrary = driver.find_element_by_xpath("//html/body/div[10]/div[1]/table/tbody/tr[7]/td[2]")
actions = ActionChains(driver)
action.click(on_element = applicationLibrary).perform() [/b]

driver.switch_to.default_content()
With this code, I am unable to click application Library element. I dont receive any error while running this code but it doesn't click.
Reply


Messages In This Thread
Unable to click element in web page - by Kalpana - Jun-25-2020, 05:20 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  cant click button by script at page michael1834 1 998 Dec-08-2023, 04:44 PM
Last Post: SpongeB0B
  Click on a button on web page using Selenium Pavel_47 7 4,570 Jan-05-2023, 04:20 AM
Last Post: ellapurnellrt
Photo Unable to Extract a web element law 6 4,900 Mar-11-2021, 09:26 PM
Last Post: law
  Selenium Parsing (unable to Parse page after loading) oneclick 7 5,894 Oct-30-2020, 08:13 PM
Last Post: tomalex
  find element...click() dont work windows11 6 3,079 Apr-23-2020, 11:13 PM
Last Post: law
  bypassing find element click() windows11 1 1,837 Apr-02-2020, 11:55 AM
Last Post: Larz60+
  wait for element and click windows11 2 2,604 Mar-21-2020, 09:23 PM
Last Post: windows11
  use Xpath in Python :: libxml2 for a page-to-page skip-setting apollo 2 3,583 Mar-19-2020, 06:13 PM
Last Post: apollo
  Unable to switch out of nested frames into main page abi17124 0 1,839 Jul-17-2019, 06:06 PM
Last Post: abi17124
  Click Element if displayed using Selenium and Python giaco__mar 1 3,492 Dec-27-2018, 06:19 PM
Last Post: metulburr

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020