Unable to identify the inner html object

251 views
Skip to first unread message

Harish Nayak

unread,
Feb 20, 2014, 5:31:20 AM2/20/14
to seleniu...@googlegroups.com
I am using Selenium Python Webdriver V 2.39. I am not able to click button "Add"[highlighted below] as i am not able to identify the object. I tried various xpath, id, name etc but all are dynamic values.

Help appreciated. Note that "Add" is in inner HTML and due to which i am unable to identify.


<span class="dijit dijitReset dijitInline idxButtonDerived dijitButton" role="presentation" widgetid="dijit_form_Button_11">
<span class="dijitReset dijitInline dijitButtonNode" role="presentation" data-dojo-attach-event="ondijitclick:__onClick">
<span id="dijit_form_Button_11" class="dijitReset dijitStretch dijitButtonContents" aria-labelledby="dijit_form_Button_11_label" role="button" data-dojo-attach-point="titleNode,focusNode" tabindex="-1" style="-moz-user-select: none;">

<span class="dijitReset dijitInline dijitIcon addIcon" data-dojo-attach-point="iconNode"></span>
<span class="dijitReset dijitToggleButtonIconChar">      ●</span>
<span id="dijit_form_Button_11_label" class="dijitReset dijitInline dijitButtonText" data-dojo-attach-point="containerNode">     Add </span></span></span>
<input class="dijitOffScreen" type="button" data-dojo-attach-point="valueNode" role="presentation" tabindex="-1" data-dojo-attach-event="onclick:_onClick" value=""></input></span> 

Harish Nayak

unread,
Feb 22, 2014, 5:40:00 AM2/22/14
to seleniu...@googlegroups.com
Tried following, but none of them working :

        driver.find_element_by_xpath("//span[@id='dijit_form_Button_11_label']").click()
        driver.find_element_by_id("dijit_form_Button_11_label").click() 
        driver.find_element_by_xpath("//span[@id='dijit_form_Button*' and contains(text(),'Add')]").click() 
        driver.find_element_by_xpath("//span[@class='dijitReset dijitInline dijitIcon addIcon' and text()='Add']").click() 
        driver.find_element_by_xpath("//span[text()='Add']").click() 
        driver.find_element_by_xpath("//span[@id='dijit_form_Button*'/@class='dijitReset dijitInline dijitIcon addIcon'/@class='dijitReset dijitToggleButtonIconChar'/@id='dijit_form_Button*' and text() = 'Add']").click()
        driver.find_element_by_xpath("//span[@class='*label' and text() = 'Add']").click()
        driver.find_element_by_css_selector("#dijit_form_Button*label").click()
        driver.find_element_by_xpath("//span[@id='dijit_form_Button*' and contains(text(),'Add')]").click()
        driver.find_element_by_xpath("//span[@class='dijit*' and text() = 'Add']").click()
        wait.until(EC.visibility_of_element_located((By.XPATH, "//div[2]/div/div/div/div[2]/div/table/tbody/tr/td/div/span[2]/span/span/span[3]")))
        driver.find_element_by_xpath("//div[2]/div/div/div/div[2]/div/table/tbody/tr/td/div/span[2]/span/span/span[3]").click()                          
        driver.find_element_by_xpath("//span[@class='dijitReset dijitInline dijitIcon addIcon' and text() = 'Add']").click()
        driver.find_element_by_xpath("//span[contains(*,'Add')]").click()                          
        driver.find_element_by_xpath("//button[contains(text(),'Add')]").click()
        driver.find_element_by_xpath("//span[contains(text(),'Add')]").click()
        driver.find_element_by_xpath("//span[contains(*,'Add')]").click()                          
        driver.find_element_by_xpath("//div[2]/div/div/div/div[2]/div/table/tbody/tr/td/div/span[2]/span/span/span[3]").click()
        driver.find_element_by_xpath("//div[contains(.,'Add')]").click()
        driver.find_element_by_xpath("//span[contains(.,'Add')]").click()
        driver.find_element_by_xpath("//*[contains(text(), 'Add')]").click()
        driver.find_element_by_xpath("//button[contains(text(),'Add')]").click()
        driver.find_element_by_xpath("//label[contains(text(),'Add')]").click()
        driver.find_element_by_xpath("//span[contains(@class,'Add')])").click()

Harish Nayak

unread,
Feb 23, 2014, 11:37:19 PM2/23/14
to seleniu...@googlegroups.com
Tried various options from last four days, none seems to work. Your help appreciated..

Alexra

unread,
Feb 27, 2014, 1:07:10 PM2/27/14
to seleniu...@googlegroups.com
1. try this: driver.find_element_by_xpath("//*[@type='button']").click();
2. if still there is no success, please check you are in the right frame (maybe there are some frames in the page and you have have to switch frame).

Harish Nayak

unread,
Feb 27, 2014, 9:18:59 PM2/27/14
to seleniu...@googlegroups.com
Thanks Alexra ..

I tried it but it is failing with following error :

ElementNotVisibleException: Message: u'element not visible\n


There is no frame defined here[i have attached the html code in first post above]

Alexra

unread,
Mar 2, 2014, 7:12:52 AM3/2/14
to seleniu...@googlegroups.com
OK, can you try one of the following?
1. check what JavaScript function runs when you click the button and run this function in the code.
2. try submit() instead of click(). 

Saravanan Ravi

unread,
Mar 5, 2014, 8:40:32 AM3/5/14
to seleniu...@googlegroups.com
Hi,
 
First try to focus on the element which changes the values of the Span tag by using MouseOver and after that try to execute your command. I guess It will work.
 
Regards,
Saravanan R
Reply all
Reply to author
Forward
0 new messages