[help] how to position check box

On the check box check method you want to use python+webdriver, at present already automatically open Webpage pop-up box, but always check failed

The following check box
Untitled2.jpg


Check box HTML source screenshot below. Source two check boxes ID, type are the same, is value
Untitled.jpg




I think through this sentence completion check, but the implementation is not successful, could you tell me how to do?
browser.find_element_by_id("productPlatformSearchSelected").click()

Started by Opera at February 18, 2016 - 3:41 AM

browser.find_elements_by_id("productPlatformSearchSelected")[0].click()

Posted by Julius at February 28, 2016 - 3:51 AM

Execute to you to that sentence, report this error


Traceback (most recent call last):
File "C:/Python27/test/CIAT.py", line 30, in <module>
browser.find_elements_by_id("productPlatformSearchSelected")[0].click()
IndexError: list index out of range

Posted by Opera at March 01, 2016 - 4:32 AM

HTML is not standard, ID should be the page only.

Definition and Usage
The id attribute specifies a unique id for an HTML element (the value must be unique within the HTML document).
http://www.w3schools.com/tags/att_global_id.asp

Posted by Nathan at March 03, 2016 - 5:06 AM

browser.find_element_by_id("productPlatformSearchSelected").click()


The above your original code, what the error report?

Posted by Julius at March 14, 2016 - 5:41 AM

I guess:
You this window is new play out, then no switch to this window, so you run the code I provide, element not found.

Posted by Julius at March 19, 2016 - 6:16 AM

Yes, the window is a new play, need in the window tick, what should be how to position


The original statement: browser.find_element_by_id (" productPlatformSearchSelected".Click)) (executive report the following error


Untitled3.jpg

Posted by Opera at April 01, 2016 - 6:58 AM

This page is the IT department to do a good job, we just use, so there is no way no specification... I would like to ask how the positioning in the present context?

Posted by Opera at April 16, 2016 - 7:26 AM

Give an example to you, must first switch to the new window, select, you can:


aalhandles = browser.window_handles
#Switch to the pop-up window
browser.switch_to_window(aalhandles[0])
#For frame
frame=browser.find_elements_by_tag_name('frame')
#Switch to the top menu frame
browser.switch_to_window(aalhandles[0])
browser.switch_to_frame(frame[0])

Posted by Julius at April 26, 2016 - 7:34 AM

In your case, I estimate is the key is
#Switch to the pop-up window
browser.switch_to_window(aalhandles[0])

Posted by Julius at May 02, 2016 - 8:00 AM

I like what you said, need to jump to a new pop-up window positioning

Puncture a fallacy with one remark secret ah, this problem has troubled me for two days, thank you very much!!!

Posted by Opera at May 17, 2016 - 9:00 AM