This is the HTML code of the Checkbox alone:
<table id="rmaAssetCosmeticComponents_ctl00_CheckBoxList_Comp_17_38788_24582_73_0_True" border="0">
<tbody><tr>
<td><input id="rmaAssetCosmeticComponents_ctl00_CheckBoxList_Comp_17_38788_24582_73_0_True_0" type="checkbox" name="rmaAssetCosmeticComponents$ctl00$CheckBoxList_Comp_17_38788_24582_73_0_True$0"><label for="rmaAssetCosmeticComponents_ctl00_CheckBoxList_Comp_17_38788_24582_73_0_True_0">Cracked Case</label></td><td><input id="rmaAssetCosmeticComponents_ctl00_CheckBoxList_Comp_17_38788_24582_73_0_True_1" type="checkbox" name="rmaAssetCosmeticComponents$ctl00$CheckBoxList_Comp_17_38788_24582_73_0_True$1"><label for="rmaAssetCosmeticComponents_ctl00_CheckBoxList_Comp_17_38788_24582_73_0_True_1">Cracked Case (Upper Half)</label></td>
</tr><tr>
<td><input id="rmaAssetCosmeticComponents_ctl00_CheckBoxList_Comp_17_38788_24582_73_0_True_2" type="checkbox" name="rmaAssetCosmeticComponents$ctl00$CheckBoxList_Comp_17_38788_24582_73_0_True$2"><label for="rmaAssetCosmeticComponents_ctl00_CheckBoxList_Comp_17_38788_24582_73_0_True_2">Cracked Face Plate</label></td><td><input id="rmaAssetCosmeticComponents_ctl00_CheckBoxList_Comp_17_38788_24582_73_0_True_3" type="checkbox" name="rmaAssetCosmeticComponents$ctl00$CheckBoxList_Comp_17_38788_24582_73_0_True$3"><label for="rmaAssetCosmeticComponents_ctl00_CheckBoxList_Comp_17_38788_24582_73_0_True_3">Deep Scratches</label></td>
</tr><tr>
<td><input id="rmaAssetCosmeticComponents_ctl00_CheckBoxList_Comp_17_38788_24582_73_0_True_4" type="checkbox" name="rmaAssetCosmeticComponents$ctl00$CheckBoxList_Comp_17_38788_24582_73_0_True$4"><label for="rmaAssetCosmeticComponents_ctl00_CheckBoxList_Comp_17_38788_24582_73_0_True_4">Discolored Case</label></td><td><input id="rmaAssetCosmeticComponents_ctl00_CheckBoxList_Comp_17_38788_24582_73_0_True_5" type="checkbox" name="rmaAssetCosmeticComponents$ctl00$CheckBoxList_Comp_17_38788_24582_73_0_True$5"><label for="rmaAssetCosmeticComponents_ctl00_CheckBoxList_Comp_17_38788_24582_73_0_True_5">Light Scratches In Case</label></td>
</tr><tr>
<td><input id="rmaAssetCosmeticComponents_ctl00_CheckBoxList_Comp_17_38788_24582_73_0_True_6" type="checkbox" name="rmaAssetCosmeticComponents$ctl00$CheckBoxList_Comp_17_38788_24582_73_0_True$6"><label for="rmaAssetCosmeticComponents_ctl00_CheckBoxList_Comp_17_38788_24582_73_0_True_6">Major Cracks</label></td><td><input id="rmaAssetCosmeticComponents_ctl00_CheckBoxList_Comp_17_38788_24582_73_0_True_7" type="checkbox" name="rmaAssetCosmeticComponents$ctl00$CheckBoxList_Comp_17_38788_24582_73_0_True$7"><label for="rmaAssetCosmeticComponents_ctl00_CheckBoxList_Comp_17_38788_24582_73_0_True_7">Major Scratches</label></td>
</tr><tr>
<td><input id="rmaAssetCosmeticComponents_ctl00_CheckBoxList_Comp_17_38788_24582_73_0_True_8" type="checkbox" name="rmaAssetCosmeticComponents$ctl00$CheckBoxList_Comp_17_38788_24582_73_0_True$8"><label for="rmaAssetCosmeticComponents_ctl00_CheckBoxList_Comp_17_38788_24582_73_0_True_8">Minor Cracks</label></td><td><input id="rmaAssetCosmeticComponents_ctl00_CheckBoxList_Comp_17_38788_24582_73_0_True_9" type="checkbox" name="rmaAssetCosmeticComponents$ctl00$CheckBoxList_Comp_17_38788_24582_73_0_True$9"><label for="rmaAssetCosmeticComponents_ctl00_CheckBoxList_Comp_17_38788_24582_73_0_True_9">Minor Scratches</label></td>
</tr><tr>
<td><input id="rmaAssetCosmeticComponents_ctl00_CheckBoxList_Comp_17_38788_24582_73_0_True_10" type="checkbox" name="rmaAssetCosmeticComponents$ctl00$CheckBoxList_Comp_17_38788_24582_73_0_True$10"><label for="rmaAssetCosmeticComponents_ctl00_CheckBoxList_Comp_17_38788_24582_73_0_True_10">Missing Port Cover</label></td><td><input id="rmaAssetCosmeticComponents_ctl00_CheckBoxList_Comp_17_38788_24582_73_0_True_11" type="checkbox" name="rmaAssetCosmeticComponents$ctl00$CheckBoxList_Comp_17_38788_24582_73_0_True$11"><label for="rmaAssetCosmeticComponents_ctl00_CheckBoxList_Comp_17_38788_24582_73_0_True_11">Missing Side Panel</label></td>
</tr><tr>
<td><input id="rmaAssetCosmeticComponents_ctl00_CheckBoxList_Comp_17_38788_24582_73_0_True_12" type="checkbox" name="rmaAssetCosmeticComponents$ctl00$CheckBoxList_Comp_17_38788_24582_73_0_True$12"><label for="rmaAssetCosmeticComponents_ctl00_CheckBoxList_Comp_17_38788_24582_73_0_True_12">No Back Cover</label></td><td><input id="rmaAssetCosmeticComponents_ctl00_CheckBoxList_Comp_17_38788_24582_73_0_True_13" type="checkbox" name="rmaAssetCosmeticComponents$ctl00$CheckBoxList_Comp_17_38788_24582_73_0_True$13"><label for="rmaAssetCosmeticComponents_ctl00_CheckBoxList_Comp_17_38788_24582_73_0_True_13">No Bay Cover</label></td>
</tr><tr>
<td><input id="rmaAssetCosmeticComponents_ctl00_CheckBoxList_Comp_17_38788_24582_73_0_True_14" type="checkbox" name="rmaAssetCosmeticComponents$ctl00$CheckBoxList_Comp_17_38788_24582_73_0_True$14"><label for="rmaAssetCosmeticComponents_ctl00_CheckBoxList_Comp_17_38788_24582_73_0_True_14">No Face Plate</label></td><td><input id="rmaAssetCosmeticComponents_ctl00_CheckBoxList_Comp_17_38788_24582_73_0_True_15" type="checkbox" name="rmaAssetCosmeticComponents$ctl00$CheckBoxList_Comp_17_38788_24582_73_0_True$15"><label for="rmaAssetCosmeticComponents_ctl00_CheckBoxList_Comp_17_38788_24582_73_0_True_15">Open Box</label></td>
</tr><tr>
<td><input id="rmaAssetCosmeticComponents_ctl00_CheckBoxList_Comp_17_38788_24582_73_0_True_16" type="checkbox" name="rmaAssetCosmeticComponents$ctl00$CheckBoxList_Comp_17_38788_24582_73_0_True$16"><label for="rmaAssetCosmeticComponents_ctl00_CheckBoxList_Comp_17_38788_24582_73_0_True_16">Open Box, Sealed Unit</label></td><td><input id="rmaAssetCosmeticComponents_ctl00_CheckBoxList_Comp_17_38788_24582_73_0_True_17" type="checkbox" name="rmaAssetCosmeticComponents$ctl00$CheckBoxList_Comp_17_38788_24582_73_0_True$17"><label for="rmaAssetCosmeticComponents_ctl00_CheckBoxList_Comp_17_38788_24582_73_0_True_17">Scratches In Screen</label></td>
</tr><tr>
<td><input id="rmaAssetCosmeticComponents_ctl00_CheckBoxList_Comp_17_38788_24582_73_0_True_18" type="checkbox" name="rmaAssetCosmeticComponents$ctl00$CheckBoxList_Comp_17_38788_24582_73_0_True$18"><label for="rmaAssetCosmeticComponents_ctl00_CheckBoxList_Comp_17_38788_24582_73_0_True_18">Sealed Box</label></td><td></td>
</tr>
</tbody></table>
Hello everyone! the problem is simple and complicated at the same time, in the pictures is my target to click, a checkbox which by all means should be easy to target but for some reason Python keeps throwing me this error (Which i encountered before but right now i can't bypass it):
Traceback (most recent call last):
File "C:\Users\AMSUser\AppData\Local\Programs\Python\Python35-32\Scripts\Add Asset.py", line 167, in <module>
nobackcover = browser.find_element_by_xpath('//*[@id="rmaAssetCosmeticComponents_ctl00_CheckBoxList_Comp_17_38774_24566_73_0_True_12"]')
File "C:\Users\AMSUser\AppData\Local\Programs\Python\Python35-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 293, in find_element_by_xpath
return self.find_element(by=By.XPATH, value=xpath)
File "C:\Users\AMSUser\AppData\Local\Programs\Python\Python35-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 752, in find_element
'value': value})['value']
File "C:\Users\AMSUser\AppData\Local\Programs\Python\Python35-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 236, in execute
self.error_handler.check_response(response)
File "C:\Users\AMSUser\AppData\Local\Programs\Python\Python35-32\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 192, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//*[@id="rmaAssetCosmeticComponents_ctl00_CheckBoxList_Comp_17_38774_24566_73_0_True_12"]"}
(Session info: chrome=52.0.2743.116)
(Driver info: chromedriver=2.23.409699 (49b0fa931cda1caad0ae15b7d1b68004acd05129),platform=Windows NT 10.0.14393 x86_64)
Or variations if i am using name or id to target the checkbox.
When i copy the xpath after inspect element with Chrome developer tools this is what i get:
"//*[@id="rmaAssetCosmeticComponents_ctl00_CheckBoxList_Comp_17_38760_24576_73_0_True_12"]".
This is the code i am using currently:
#Here i open the checkbox menu that gives me the checkbox i need to click
Cosmeticselect = browser.find_element_by_xpath('//*[@id="rmaAssetCosmeticComponents_ctl00_btnAdd"]')
Cosmeticselect.click()
#2 seconds delay because it takes a second to load.
time.sleep(2)
#I have tried several iterations of this none give me the desire output, maybe this checkbox is in another iframe? if so i have yet to find it in the code.
nobackcover = browser.find_element_by_id('rmaAssetCosmeticComponents_ctl00_CheckBoxList_Comp_17_38776_24568_73_0_True_12')
#nobackcover = browser.find_element_by_xpath('//*[@id="rmaAssetCosmeticComponents_ctl00_CheckBoxList_Comp_17_38775_24567_73_0_True"]/tbody/tr[7]/td[1]/label')
#nobackcover = browser.find_element_by_name('rmaAssetCosmeticComponents$ctl00$CheckBoxList_Comp_17_38778_24570_73_0_True$12')
nobackcover.click()
I suspect that i have to switch to the cosmetics "window" but i have yet to find a reference to an iframe or the like, i will keep working on it and when i find i solution i will post it but if anyone is interested in adding a fresh pair of eyes to this problem i would appreciate it.