cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
%3CLINGO-SUB%20id%3D%22lingo-sub-485000%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%20mode%3D%22NONE%22%20mode%3D%22NONE%22%3E%E4%BD%BF%E7%94%A8%20Python%20Selenium%20%E7%B7%A8%E5%AF%AB%E7%80%8F%E8%A6%BD%E5%99%A8%E8%85%B3%E6%9C%AC%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-485000%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%20mode%3D%22NONE%22%20mode%3D%22NONE%22%3E%3CP%3E%E5%A4%A7%E5%A4%9A%E6%95%B8%E7%B6%B2%E7%B5%A1%E9%83%BD%E4%BD%BF%E7%94%A8%20Restful%20API%20%E5%B0%87%E6%95%B8%E6%93%9A%E7%A7%BB%E5%85%A5%E5%92%8C%E7%A7%BB%E5%87%BA%E6%9C%8D%E5%8B%99%E5%99%A8%E3%80%82%20%3CEM%3E%E4%BC%91%E6%81%AF%3C%2FEM%3E%E9%80%99%E6%98%AF%E4%B8%80%E5%80%8B%E7%B0%A1%E5%96%AE%E7%9A%84%E6%A6%82%E5%BF%B5%EF%BC%8C%E8%88%87%E7%9D%A1%E7%9C%A0%E7%84%A1%E9%97%9C%EF%BC%9B%3CEM%3E%E4%BC%91%E6%81%AF%3C%2FEM%3E%E6%96%B9%E6%B3%95%3CA%20href%3D%22https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FRepresentational_state_transfer%22%20target%3D%22_self%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3E%E4%BB%A3%E8%A1%A8%E6%80%A7%E7%8B%80%E6%85%8B%E8%BD%89%E7%A7%BB%3C%2FA%3E%EF%BC%8C%E4%BD%86%E6%9C%AC%E6%96%87%E4%B8%8D%E6%98%AF%E9%97%9C%E6%96%BC%3CEM%3E%E4%BC%91%E6%81%AF%3C%2FEM%3E%E3%80%82%20%E6%9C%AC%E6%96%87%E4%BB%8B%E7%B4%B9%E4%BA%86%E4%B8%80%E7%A8%AE%E7%AC%A8%E6%8B%99%E7%9A%84%E6%A9%9F%E5%88%B6%EF%BC%8C%E7%94%A8%E6%96%BC%E8%A7%A3%E6%B1%BA%E7%95%B6%E6%82%A8%E7%A2%BA%E5%AF%A6%E9%9C%80%E8%A6%81%E5%BE%9E%E7%AB%99%E9%BB%9E%E6%AA%A2%E7%B4%A2%E6%9F%90%E4%BA%9B%E6%95%B8%E6%93%9A%E6%99%82%E7%BC%BA%E4%B9%8F%20REST%20API%20%E7%9A%84%E5%95%8F%E9%A1%8C%E3%80%82%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%E7%B6%B2%E7%AB%99%E5%8F%AF%E8%83%BD%E5%87%BA%E6%96%BC%E5%90%84%E7%A8%AE%E5%8E%9F%E5%9B%A0%E4%B8%8D%E5%B8%8C%E6%9C%9B%E6%82%A8%E9%80%99%E6%A8%A3%E5%81%9A%EF%BC%9A%E6%95%B8%E6%93%9A%E5%B8%B6%E5%AF%AC%E9%9C%80%E8%A6%81%E8%8A%B1%E9%8C%A2%EF%BC%8C%E6%95%B8%E6%93%9A%E8%A8%B1%E5%8F%AF%E9%9C%80%E8%A6%81%E8%8A%B1%E9%8C%A2%EF%BC%8C%E4%B8%8D%E7%9C%8B%E5%BB%A3%E5%91%8A%E4%B9%9F%E5%8F%AF%E8%83%BD%E8%A6%81%E8%8A%B1%E9%8C%A2%E3%80%82%20%E9%80%99%E5%80%8B%E5%B7%A5%E5%85%B7%EF%BC%8C%3CA%20href%3D%22https%3A%2F%2Fselenium-python.readthedocs.io%2Finstallation.html%23introduction%22%20target%3D%22_self%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3E%E7%A1%92%3C%2FA%3E%EF%BC%8C%E5%90%8D%E7%BE%A9%E4%B8%8A%E7%94%A8%E6%96%BC%E6%B8%AC%E8%A9%A6%E7%B6%B2%E7%AB%99%EF%BC%8C%E8%80%8C%E4%B8%8D%E6%98%AF%E7%94%A8%E6%96%BC%E5%9C%A8%E6%B8%9B%E9%80%9F%E5%B8%B6%E4%B8%8A%E5%8A%A0%E9%80%9F%E3%80%82%20%E5%A4%A7%E5%A4%9A%E6%95%B8%E7%B6%B2%E7%AB%99%E9%83%BD%E6%9C%89%E4%BD%BF%E7%94%A8%E6%A2%9D%E6%AC%BE%EF%BC%9B%E6%82%A8%E5%8F%AF%E4%BB%A5%E5%9C%A8%E6%9C%AC%E9%A0%81%E5%BA%95%E9%83%A8%E6%89%BE%E5%88%B0%20JMP%20%E7%9A%84%E6%A2%9D%E6%AC%BE%E3%80%82%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%E9%99%84%E4%B8%8A%E5%AE%8C%E6%95%B4%E7%9A%84%20JSL%20%E6%96%87%E4%BB%B6%E3%80%82%20%E5%AE%83%E6%98%AF%E7%82%BA%20Firefox%E3%80%81Windows%20%E5%92%8C%20JMP%20%E7%B6%B2%E7%AB%99%E7%B7%A8%E5%AF%AB%E7%9A%84%EF%BC%8C%E5%A6%82%202022%20%E5%B9%B4%205%20%E6%9C%88%208%20%E6%97%A5%E6%89%80%E7%A4%BA%E3%80%82%20Firefox%20%E9%83%A8%E5%88%86%E5%8F%AF%E8%83%BD%E5%8F%AF%E4%BB%A5%E6%9B%B4%E6%94%B9%E7%82%BA%E8%A8%B1%E5%A4%9A%E5%85%B6%E4%BB%96%E7%80%8F%E8%A6%BD%E5%99%A8%E3%80%82%20%E5%AE%83%E4%B9%9F%E5%8F%AF%E8%83%BD%E5%9C%A8%20Mac%20%E4%B8%8A%E9%81%8B%E8%A1%8C%EF%BC%8C%E6%9C%AA%E9%80%B2%E8%A1%8C%E6%B8%AC%E8%A9%A6%E3%80%82%20JMP%20%E7%B6%B2%E7%AB%99%E6%9C%83%E9%9A%A8%E8%91%97%E6%99%82%E9%96%93%E7%9A%84%E6%8E%A8%E7%A7%BB%E8%80%8C%E7%99%BC%E7%94%9F%E8%AE%8A%E5%8C%96%EF%BC%8CJSL%20%E4%B9%9F%E9%9C%80%E8%A6%81%E8%AA%BF%E6%95%B4%E3%80%82%20%E9%80%99%E5%B0%B1%E6%98%AF%E4%B8%8D%E4%BD%BF%E7%94%A8%E5%AE%98%E6%96%B9%20API%20%E7%9A%84%E7%BC%BA%E9%BB%9E%E3%80%82%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%E5%9C%A8%E9%96%8B%E5%A7%8B%E4%B9%8B%E5%89%8D%EF%BC%8C%E8%AB%8B%E4%B8%8B%E8%BC%89%E9%A9%85%E5%8B%95%E7%A8%8B%E5%BA%8F%E4%B8%A6%E5%AE%89%E8%A3%9D%20selenium%EF%BC%8C%E5%A6%82%E4%B8%8B%E9%9D%A2%E7%9A%84%E8%A9%95%E8%AB%96%E6%89%80%E7%A4%BA%E3%80%82%20%E6%82%A8%E9%82%84%E9%9C%80%E8%A6%81%20Firefox%EF%BC%8C%E6%88%96%E8%80%85%E5%B0%8D%E6%82%A8%E5%96%9C%E6%AD%A1%E7%9A%84%E7%80%8F%E8%A6%BD%E5%99%A8%E7%9A%84%E9%A9%85%E5%8B%95%E7%A8%8B%E5%BA%8F%E9%80%B2%E8%A1%8C%E4%B8%80%E4%BA%9B%E7%A0%94%E7%A9%B6%E3%80%82%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3E%2F%2F%20JMP%20%2B%20Python%20%2B%20Selenium%20%2B%20Firefox%20(probably%20works%20with%20Chrome%20or%20Edge%20with%20a%20few%20tweaks)%0A%2F%2F%20https%3A%2F%2Ffirefox-source-docs.mozilla.org%2Ftesting%2Fgeckodriver%2Findex.html%0A%2F%2F%20https%3A%2F%2Fselenium-python.readthedocs.io%2F%0A%0A%2F%2F%20downloaded%20%20%20%20%20%20%20%20%20%20%20%20https%3A%2F%2Fgithub.com%2Fmozilla%2Fgeckodriver%2Freleases%20%20%20%20--%20geckodriver-...-win64.zip%20(pick%20latest)%0A%2F%2F%20expand%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20on%20desktop%20%20%20geckodriver.exe%0A%2F%2F%20installed%20selenium%20%20%20%20python%20-m%20pip%20install%20selenium%0A%0A%2F%2F%20the%20following%20code%20is%20welded%20into%20the%20JMP.COM's%20HTML%20of%208May2022.%20It%20could%20change%20at%20anytime.%0A%2F%2F%20the%20functions%20are%20sprinkled%20through%20the%20JSL%20below%2C%20near%20where%20I%20first%20needed%20them%2C%20reused%20later.%0A%2F%2F%20you'll%20need%20similar%20functions%2C%20probably%2C%20and%20want%20to%20consult%20the%20Python%20Selenium%20bindings%20to%20write%20them.%0A%2F%2F%20I%20only%20wrote%20enough%20to%20make%20this%20simple%20example%20work.%20There%20is%20no%20actual%20need%20to%20be%20logged%20in%20to%20JMP.%0A%2F%2F%0A%2F%2F%20Using%20try...except%20on%20snips%20of%20python%20code%20makes%20debugging%20much%20easier.%20JMP%20loses%20the%20exception%20message%20without%20it.%0A%2F%2F%0A%2F%2F%20the%20JSL%20functions%20are%20thin%20wrappers%20around%20the%20python%20calls%20to%20selenium%20which%20(I%20believe)%20is%0A%2F%2F%20a%20thin%20wrapper%20to%20generate%20an%20API%20call%20to%20the%20gecko%20(etc)%20driver.%20I%20*think*%20it%20might%20be%20possible%20to%0A%2F%2F%20remove%20the%20python%20layer%20and%20load%2Fcall%20the%20driver%20directly%20from%20JSL.%20But%20Selenium%20is%20documented.%0A%0APython%20Init()%3B%20%2F%2F%20one-time%20startup...%0A%0A%2F%2F%200%3A%20startup%20%0A%0Axrc%20%3D%20Python%20Execute(%20%7B%7D%2C%20%7BBy_ID%2C%20By_XPATH%2C%20rc%7D%2C%0A%22%5C%5B%0Atry%3A%0A%20%20%20%20from%20selenium%20import%20webdriver%0A%20%20%20%20from%20selenium.common.exceptions%20import%20TimeoutException%0A%20%20%20%20from%20selenium.webdriver.support.ui%20import%20WebDriverWait%0A%20%20%20%20from%20selenium.webdriver.support%20import%20expected_conditions%20as%20EC%0A%20%20%20%20from%20selenium.webdriver.common.keys%20import%20Keys%0A%20%20%20%20from%20selenium.webdriver.common.by%20import%20By%0A%20%20%20%20from%20selenium.webdriver.firefox.service%20import%20Service%0A%20%20%20%20from%20selenium.webdriver.firefox.options%20import%20Options%0A%20%20%20%20%23%0A%20%20%20%20options%20%3D%20webdriver.FirefoxOptions()%0A%20%20%20%20%23options.add_argument(%22--private%22)%20%23%20example.%20you%20most%20likely%20don't%20want%20private%2C%20some%20things%20don't%20work.%0A%20%20%20%20%23%0A%20%20%20%20service%3DService(r'C%3A%5CUsers%5Cv1%5CDesktop%5Cgeckodriver.exe')%0A%20%20%20%20%23%20sometimes%20people%20use%20%22browser%22%20rather%20than%20%22driver%22.%20It%20will%20be%20used%20below.%0A%20%20%20%20driver%20%3D%20webdriver.Firefox(service%3Dservice%2Coptions%3Doptions)%0A%20%20%20%20%23%20return%20two%20magic%20values.%20you%20may%20need%20some%20others%2C%20just%20add%20them%20in%20the%20same%20way...%0A%20%20%20%20By_ID%20%3D%20By.ID%0A%20%20%20%20By_XPATH%20%3D%20By.XPATH%0A%20%20%20%20rc%20%3D%20%22ok%22%0Aexcept%20Exception%20as%20e%3A%0A%20%20%20%20rc%20%3D%20repr(e)%0A%5D%5C%22%0A)%3B%0A%0AIf(%20xrc%20!%3D%200%20%7C%20rc%20!%3D%20%22ok%22%2C%20Throw(%20%22start%20up%20Selenium%20failed%22%20%7C%7C%20Try(%20%22%3A%20%22%20%7C%7C%20Char(%20rc%20)%2C%20%22%22%20)%20)%20)%3B%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EPythonInit()%20%E5%8F%AA%E9%9C%80%E8%A6%81%E5%9F%B7%E8%A1%8C%E4%B8%80%E6%AC%A1%EF%BC%9B%E5%AE%83%E5%B0%87%20JMP%20%E9%80%A3%E6%8E%A5%E5%88%B0%20Python%EF%BC%8C%E7%AC%AC%E4%B8%80%E6%AC%A1%E9%9C%80%E8%A6%81%E5%B9%BE%E7%A7%92%E9%90%98%E3%80%82%20%E6%82%A8%E5%8F%AF%E4%BB%A5%E5%86%8D%E6%AC%A1%E8%AA%BF%E7%94%A8%EF%BC%8C%E4%B8%8D%E6%9C%83%E5%8F%97%E5%88%B0%E4%BB%BB%E4%BD%95%E8%99%95%E7%BD%B0%E3%80%82%20PythonExecute(...)%20%E4%B8%8D%E7%99%BC%E9%80%81%E4%BB%BB%E4%BD%95%E8%AE%8A%E9%87%8F%EF%BC%8C%E4%BD%86%E5%BE%9E%E5%AE%83%E9%81%8B%E8%A1%8C%E7%9A%84%E4%BB%A3%E7%A2%BC%E4%B8%AD%E8%BF%94%E5%9B%9E%E4%B8%89%E5%80%8B%E8%AE%8A%E9%87%8F%E3%80%82%20%E5%8A%A0%E8%BC%89%E6%89%80%E6%9C%89%E5%85%A7%E5%AE%B9%E4%B8%A6%E5%95%9F%E5%8B%95%E7%80%8F%E8%A6%BD%E5%99%A8%E9%9C%80%E8%A6%81%E4%B8%80%E4%BA%9B%E6%99%82%E9%96%93%E3%80%82%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22You%20are%20looking%20at%20an%20empty%20browser%20controlled%20by%20JMP%22%20style%3D%22width%3A%20489px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22You%20are%20looking%20at%20an%20empty%20browser%20controlled%20by%20JMP%22%20style%3D%22width%3A%20489px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22You%20are%20looking%20at%20an%20empty%20browser%20controlled%20by%20JMP%22%20style%3D%22width%3A%20489px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22You%20are%20looking%20at%20an%20empty%20browser%20controlled%20by%20JMP%22%20style%3D%22width%3A%20489px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22You%20are%20looking%20at%20an%20empty%20browser%20controlled%20by%20JMP%22%20style%3D%22width%3A%20489px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F42304i1F98125C609AD5B1%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22Capture0.PNG%22%20alt%3D%22You%20are%20looking%20at%20an%20empty%20browser%20controlled%20by%20JMP%22%20%2F%3E%3Cspan%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EYou%20are%20looking%20at%20an%20empty%20browser%20controlled%20by%20JMP%3C%2Fspan%3E%3C%2Fspan%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EYou%20are%20looking%20at%20an%20empty%20browser%20controlled%20by%20JMP%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EYou%20are%20looking%20at%20an%20empty%20browser%20controlled%20by%20JMP%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EYou%20are%20looking%20at%20an%20empty%20browser%20controlled%20by%20JMP%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3E%E6%82%A8%E6%AD%A3%E5%9C%A8%E6%9F%A5%E7%9C%8B%E7%94%B1%20JMP%20%E6%8E%A7%E5%88%B6%E7%9A%84%E7%A9%BA%E7%80%8F%E8%A6%BD%E5%99%A8%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%E6%8E%A5%E4%B8%8B%E4%BE%86%E6%89%93%E9%96%8B%20JMP.COM%20%E9%A0%81%E9%9D%A2%E3%80%82%20%E6%82%A8%E5%8F%AF%E8%83%BD%E6%9C%83%E7%9C%8B%E5%88%B0%E9%80%9A%E5%B8%B8%E4%B8%8D%E6%9C%83%E8%A2%AB%E6%B3%A8%E6%84%8F%E5%88%B0%E7%9A%84%E9%87%8D%E5%AE%9A%E5%90%91%E3%80%82%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3E%2F%2F%201%3A%20navigate%20to%20jmp.com%0A%0Anav%20%3D%20Function(%20%7Burl%7D%2C%20%7Brc%7D%2C%0A%20%20%20%20Python%20Execute(%20%7Burl%7D%2C%20%7Brc%7D%2C%20%0A%22%5C%5B%0Atry%3A%0A%20%20%20%20driver.get(url)%0A%20%20%20%20rc%20%3D%20%22ok%22%0Aexcept%20Exception%20as%20e%3A%0A%20%20%20%20rc%20%3D%20repr(e)%0A%5D%5C%22%20)%3B%0A%20%20%20%20return(rc)%3B%0A)%3B%0A%0Arc%20%3D%20nav(%20%22https%3A%2F%2Fwww.jmp.com%2F%22%20)%3B%0Aif(%20rc%20!%3D%20%22ok%22%2C%20throw(%22nav%3A%20%22%7C%7Cchar(rc)))%3B%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3Enav%20%E5%87%BD%E6%95%B8%E8%BF%94%E5%9B%9E%E2%80%9Cok%E2%80%9D%E6%88%96%E9%8C%AF%E8%AA%A4%E6%B6%88%E6%81%AF%E3%80%82%20JMP%20%E7%B6%B2%E9%A0%81%E5%9C%A8%E7%80%8F%E8%A6%BD%E5%99%A8%E4%B8%AD%E5%8A%A0%E8%BC%89%E3%80%82%20%E5%BF%BD%E7%95%A5%E5%B1%8F%E5%B9%95%E6%88%AA%E5%9C%96%E4%B8%AD%E7%9A%84%E4%BA%BA%E3%80%82%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22The%20icon%20means%20the%20browser%20is%20remote%20controlled.%22%20style%3D%22width%3A%20709px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22The%20icon%20means%20the%20browser%20is%20remote%20controlled.%22%20style%3D%22width%3A%20709px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22The%20icon%20means%20the%20browser%20is%20remote%20controlled.%22%20style%3D%22width%3A%20709px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22The%20icon%20means%20the%20browser%20is%20remote%20controlled.%22%20style%3D%22width%3A%20709px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22The%20icon%20means%20the%20browser%20is%20remote%20controlled.%22%20style%3D%22width%3A%20709px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F42305i3AD7CCE21D087CBE%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22Capture1.PNG%22%20alt%3D%22The%20icon%20means%20the%20browser%20is%20remote%20controlled.%22%20%2F%3E%3Cspan%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EThe%20icon%20means%20the%20browser%20is%20remote%20controlled.%3C%2Fspan%3E%3C%2Fspan%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EThe%20icon%20means%20the%20browser%20is%20remote%20controlled.%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EThe%20icon%20means%20the%20browser%20is%20remote%20controlled.%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EThe%20icon%20means%20the%20browser%20is%20remote%20controlled.%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3E%E8%A9%B2%E5%9C%96%E6%A8%99%E8%A1%A8%E7%A4%BA%E7%80%8F%E8%A6%BD%E5%99%A8%E5%B7%B2%E8%A2%AB%E9%81%A0%E7%A8%8B%E6%8E%A7%E5%88%B6%E3%80%82%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%E7%B7%A8%E5%AF%AB%20JMP%20%E7%AB%99%E9%BB%9E%E7%99%BB%E9%8C%84%E8%85%B3%E6%9C%AC%E3%80%82%20%E5%8F%B3%E9%8D%B5%E5%96%AE%E6%93%8A%E2%80%9C%E7%99%BB%E9%8C%84%E2%80%9D%E6%8C%89%E9%88%95%E4%BB%A5%E6%9F%A5%E6%89%BE%E8%A9%B2%E6%8C%89%E9%88%95%E7%9A%84%20HTML%20id%20%E5%80%BC%E3%80%82%20%E8%A8%98%E4%BD%8F%E5%A6%82%E4%BD%95%E5%81%9A%E5%88%B0%E9%80%99%E4%B8%80%E9%BB%9E%EF%BC%9B%E6%9C%80%E5%BE%8C%E6%88%91%E6%9C%83%E8%B7%B3%E9%81%8E%E9%80%99%E5%80%8B%E8%A7%A3%E9%87%8B......%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22F12%20might%20bring%20you%20to%20the%20next%20screen%2C%20but%20this%20way%20the%20control%20will%20already%20be%20selected.%22%20style%3D%22width%3A%20709px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22F12%20might%20bring%20you%20to%20the%20next%20screen%2C%20but%20this%20way%20the%20control%20will%20already%20be%20selected.%22%20style%3D%22width%3A%20709px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22F12%20might%20bring%20you%20to%20the%20next%20screen%2C%20but%20this%20way%20the%20control%20will%20already%20be%20selected.%22%20style%3D%22width%3A%20709px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22F12%20might%20bring%20you%20to%20the%20next%20screen%2C%20but%20this%20way%20the%20control%20will%20already%20be%20selected.%22%20style%3D%22width%3A%20709px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22F12%20might%20bring%20you%20to%20the%20next%20screen%2C%20but%20this%20way%20the%20control%20will%20already%20be%20selected.%22%20style%3D%22width%3A%20709px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F42306iEA13224C930F4720%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22Capture2.PNG%22%20alt%3D%22F12%20might%20bring%20you%20to%20the%20next%20screen%2C%20but%20this%20way%20the%20control%20will%20already%20be%20selected.%22%20%2F%3E%3Cspan%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EF12%20might%20bring%20you%20to%20the%20next%20screen%2C%20but%20this%20way%20the%20control%20will%20already%20be%20selected.%3C%2Fspan%3E%3C%2Fspan%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EF12%20might%20bring%20you%20to%20the%20next%20screen%2C%20but%20this%20way%20the%20control%20will%20already%20be%20selected.%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EF12%20might%20bring%20you%20to%20the%20next%20screen%2C%20but%20this%20way%20the%20control%20will%20already%20be%20selected.%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EF12%20might%20bring%20you%20to%20the%20next%20screen%2C%20but%20this%20way%20the%20control%20will%20already%20be%20selected.%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EF12%20%E5%8F%AF%E8%83%BD%E6%9C%83%E5%B0%87%E6%82%A8%E5%B8%B6%E5%88%B0%E4%B8%8B%E4%B8%80%E5%80%8B%E5%B1%8F%E5%B9%95%EF%BC%8C%E4%BD%86%E9%80%99%E6%A8%A3%E6%8E%A7%E4%BB%B6%E5%B0%B1%E5%B7%B2%E7%B6%93%E8%A2%AB%E9%81%B8%E4%B8%AD%E3%80%82%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%E9%96%8B%E7%99%BC%E8%80%85%E6%8E%A7%E5%88%B6%E5%8F%B0%E5%B0%87%E6%89%93%E9%96%8B%E4%B8%A6%E9%A1%AF%E7%A4%BA%E6%8E%A7%E4%BB%B6%E7%9A%84%20id%E3%80%82%20%E5%86%8D%E5%BE%80%E4%B8%8B%EF%BC%8C%E5%B0%87%E6%9C%89%E4%B8%80%E4%BA%9B%E5%85%B7%E6%9C%89%E9%A1%9E%E4%BD%86%E6%B2%92%E6%9C%89%20id%20%E7%9A%84%E6%8E%A7%E4%BB%B6%E3%80%82%20Selenium%20%E7%9A%84%20XPATH%20%E5%8F%AF%E4%BB%A5%E8%99%95%E7%90%86%E5%AE%83%E3%80%82%20%E9%80%99%E5%80%8B%E6%8A%80%E5%B7%A7%E9%A1%9E%E4%BC%BC%E6%96%BC%E9%A1%AF%E7%A4%BA%E6%A1%86%E5%B0%8E%E8%88%AA%E2%80%94%E2%80%94%E6%89%BE%E5%88%B0%E4%B8%80%E6%A2%9D%E4%B8%8D%E5%A4%AA%E8%84%86%E5%BC%B1%E4%B8%94%E4%BB%8D%E7%84%B6%E8%B6%B3%E5%A4%A0%E5%85%B7%E9%AB%94%E7%9A%84%E8%B7%AF%E5%BE%91%E3%80%82%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Use%20the%20button%20id%20in%20the%20JSL%20that%20follows.%22%20style%3D%22width%3A%20700px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Use%20the%20button%20id%20in%20the%20JSL%20that%20follows.%22%20style%3D%22width%3A%20700px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Use%20the%20button%20id%20in%20the%20JSL%20that%20follows.%22%20style%3D%22width%3A%20700px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Use%20the%20button%20id%20in%20the%20JSL%20that%20follows.%22%20style%3D%22width%3A%20700px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Use%20the%20button%20id%20in%20the%20JSL%20that%20follows.%22%20style%3D%22width%3A%20700px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F42307i3D9C7E9019AA1F7A%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22Capture3.PNG%22%20alt%3D%22Use%20the%20button%20id%20in%20the%20JSL%20that%20follows.%22%20%2F%3E%3Cspan%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EUse%20the%20button%20id%20in%20the%20JSL%20that%20follows.%3C%2Fspan%3E%3C%2Fspan%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EUse%20the%20button%20id%20in%20the%20JSL%20that%20follows.%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EUse%20the%20button%20id%20in%20the%20JSL%20that%20follows.%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EUse%20the%20button%20id%20in%20the%20JSL%20that%20follows.%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3E%E4%BD%BF%E7%94%A8%E5%BE%8C%E9%9D%A2%20JSL%20%E4%B8%AD%E7%9A%84%E6%8C%89%E9%88%95%20ID%E3%80%82%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EID%20%E9%80%9A%E5%B8%B8%E6%98%AF%E5%8F%AF%E7%94%A8%E7%9A%84%E6%9C%80%E4%BD%B3%E9%81%B8%E6%93%87%EF%BC%8C%E5%9B%A0%E7%82%BA%E5%AE%83%E5%80%91%E5%9C%A8%E9%A0%81%E9%9D%A2%E4%B8%8A%E6%98%AF%E5%94%AF%E4%B8%80%E7%9A%84%E3%80%82%20WaitID%20%E6%9C%80%E5%A4%9A%E7%AD%89%E5%BE%85%2010%20%E7%A7%92%EF%BC%8C%E7%9B%B4%E5%88%B0%E7%99%BB%E9%8C%84%E6%8C%89%E9%88%95%E5%87%BA%E7%8F%BE%E3%80%82%20%E5%8F%AF%E8%83%BD%E4%B8%8D%E9%9C%80%E8%A6%81%E7%AD%89%E5%BE%85%E3%80%82%20%E5%A6%82%E6%9E%9C%E5%AE%83%E5%B7%B2%E7%B6%93%E5%9C%A8%E9%82%A3%E8%A3%A1%EF%BC%8C%E9%82%A3%E9%BA%BC%E4%B8%8D%E9%9C%80%E8%A6%81%E6%99%82%E9%96%93%E3%80%82%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3E%2F%2F%202%3A%20login%20with%20userid%2Fpassword%20credentials%0A%0A%2F%2F%20wait%20for%20an%20id%20to%20be%20available%0AwaitID%20%3D%20Function(%20%7Bid%2C%20timeout%20%3D%2010%2C%20BYformat%3DBy_ID%7D%2C%20%7Brc%7D%2C%0A%20%20%20%20Python%20Execute(%20%7Bid%2C%20timeout%2C%20BYformat%7D%2C%20%20%7Brc%7D%2C%0A%22%5C%5B%0Atry%3A%0A%20%20%20%20myElem%20%3D%20WebDriverWait(driver%2C%20timeout).until(EC.presence_of_element_located((BYformat%2C%20id)))%0A%20%20%20%20rc%20%3D%20%22ok%22%0Aexcept%20TimeoutException%3A%0A%20%20%20%20rc%20%3D%20%22timeout%22%0Aexcept%20Exception%20as%20e%3A%0A%20%20%20%20rc%20%3D%20repr(e)%0A%5D%5C%22%0A%20%20%20%20)%3B%0A%20%20%20%20Return(%20rc%20)%3B%0A)%3B%0Arc%20%3D%20waitID(%20%22loginButton%22%2C%205%20)%3B%0AIf(%20rc%20!%3D%20%22ok%22%2C%20Throw(%20%22no%20login%20button%3A%20%22%20%7C%7C%20char(rc)%20)%20)%3B%0A%0A%2F%2F%20click%20a%20button%20ID%0AclickID%20%3D%20Function(%20%7Bid%2C%20BYformat%3DBy_ID%7D%2C%20%7Brc%7D%2C%0A%20%20%20%20Python%20Execute(%20%7Bid%2C%20BYformat%7D%2C%20%7Brc%7D%2C%0A%22%5C%5B%0Atry%3A%0A%20%20%20%20driver.find_element(BYformat%2C%20id).click()%0A%20%20%20%20rc%20%3D%20%22ok%22%0Aexcept%20Exception%20as%20e%3A%0A%20%20%20%20rc%20%3D%20repr(e)%0A%5D%5C%22%0A%20%20%20%20)%3B%0A%20%20%20%20return(rc)%3B%0A)%3B%0Arc%20%3D%20clickID(%20%22loginButton%22%20)%3B%0Aif(%20rc%20!%3D%20%22ok%22%2C%20throw(%22login%20button%3A%20%22%7C%7Cchar(rc)))%3B%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%E6%B6%BC%E7%88%BD%E7%9A%84%EF%BC%81%20%E5%B1%8F%E5%B9%95%E4%B8%8A%E6%9C%83%E5%BD%88%E5%87%BA%E6%A8%99%E8%AA%8C%E3%80%82%20%E6%8E%A5%E4%B8%8B%E4%BE%86%E6%89%BE%E5%88%B0%E7%94%A8%E6%88%B6%E5%90%8D%E5%AD%97%E6%AE%B5%E3%80%82%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Now%20get%20the%20id%20for%20the%20user%20name%20field%20by%20right-click...%22%20style%3D%22width%3A%20708px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Now%20get%20the%20id%20for%20the%20user%20name%20field%20by%20right-click...%22%20style%3D%22width%3A%20708px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Now%20get%20the%20id%20for%20the%20user%20name%20field%20by%20right-click...%22%20style%3D%22width%3A%20708px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Now%20get%20the%20id%20for%20the%20user%20name%20field%20by%20right-click...%22%20style%3D%22width%3A%20708px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Now%20get%20the%20id%20for%20the%20user%20name%20field%20by%20right-click...%22%20style%3D%22width%3A%20708px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F42308iD9C5A70ADA9D3B42%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22Capture4.PNG%22%20alt%3D%22Now%20get%20the%20id%20for%20the%20user%20name%20field%20by%20right-click...%22%20%2F%3E%3Cspan%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3ENow%20get%20the%20id%20for%20the%20user%20name%20field%20by%20right-click...%3C%2Fspan%3E%3C%2Fspan%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3ENow%20get%20the%20id%20for%20the%20user%20name%20field%20by%20right-click...%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3ENow%20get%20the%20id%20for%20the%20user%20name%20field%20by%20right-click...%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3ENow%20get%20the%20id%20for%20the%20user%20name%20field%20by%20right-click...%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3E%E7%8F%BE%E5%9C%A8%E9%80%9A%E9%81%8E%E5%8F%B3%E9%8D%B5%E5%96%AE%E6%93%8A%E7%8D%B2%E5%8F%96%E7%94%A8%E6%88%B6%E5%90%8D%E5%AD%97%E6%AE%B5%E7%9A%84%20id...%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%E5%86%8D%E6%AC%A1%E7%AD%89%E5%BE%85%E9%A0%90%E6%9C%9F%E7%9A%84%E5%AD%97%E6%AE%B5%E3%80%82%20%E7%8F%BE%E5%9C%A8%E9%9C%80%E8%A6%81%E4%B8%80%E5%80%8B%E6%8C%89%E9%8D%B5%E5%8A%9F%E8%83%BD......%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3Erc%20%3D%20waitID(%20%22idp-discovery-username%22%2C%2010%20)%3B%0AIf(%20rc%20!%3D%20%22ok%22%2C%20Throw(%20%22no%20username%20field%3A%20%22%20%7C%7C%20char(rc)%20)%20)%3B%0A%0A%2F%2F%20type%20a%20value%20into%20a%20field%0AkeysToID%20%3D%20Function(%20%7Bid%2C%20txt%7D%2C%20%7Brc%7D%2C%0A%20%20%20%20Python%20Execute(%20%7Bid%2C%20txt%7D%2C%20%7Brc%7D%2C%0A%22%5C%5B%0Atry%3A%0A%20%20%20%20driver.find_element(By.ID%2C%20id).send_keys(txt)%0A%20%20%20%20rc%20%3D%20%22ok%22%0Aexcept%20Exception%20as%20e%3A%0A%20%20%20%20rc%20%3D%20repr(e)%0A%5D%5C%22%0A%20%20%20%20)%3B%0A%20%20%20%20return(rc)%3B%0A)%3B%0Arc%20%3D%20keysToID(%20%22idp-discovery-username%22%2C%20Include(%20%22%24documents%2FUserID.jsl%22%20)%20)%3B%20%2F%2F%20file%20contains%20%22AliBaba%401000%26amp%3BOneNights.com%22%2C%20in%20quotation%20marks%2C%20possibly%20encrypted%0Aif(%20rc%20!%3D%20%22ok%22%2C%20throw(%22keysToID%20username%3A%20%22%7C%7Cchar(rc)))%3B%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Fake%20user%20name%20for%20fake%20password.%22%20style%3D%22width%3A%20331px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Fake%20user%20name%20for%20fake%20password.%22%20style%3D%22width%3A%20331px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Fake%20user%20name%20for%20fake%20password.%22%20style%3D%22width%3A%20331px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Fake%20user%20name%20for%20fake%20password.%22%20style%3D%22width%3A%20331px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Fake%20user%20name%20for%20fake%20password.%22%20style%3D%22width%3A%20331px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F42315iCA66756649979FBE%2Fimage-dimensions%2F331x171%3Fv%3Dv2%22%20width%3D%22331%22%20height%3D%22171%22%20role%3D%22button%22%20title%3D%22UserName.PNG%22%20alt%3D%22Fake%20user%20name%20for%20fake%20password.%22%20%2F%3E%3Cspan%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EFake%20user%20name%20for%20fake%20password.%3C%2Fspan%3E%3C%2Fspan%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EFake%20user%20name%20for%20fake%20password.%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EFake%20user%20name%20for%20fake%20password.%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EFake%20user%20name%20for%20fake%20password.%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3E%E5%81%87%E7%94%A8%E6%88%B6%E5%90%8D%E9%85%8D%E5%81%87%E5%AF%86%E7%A2%BC%E3%80%82%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%E6%88%91%E7%9A%84%E7%94%A8%E6%88%B6%20ID%20%E6%BB%BE%E5%87%BA%E5%B1%8F%E5%B9%95%EF%BC%8C%E4%B8%8B%E4%B8%80%E5%80%8B%E6%8C%89%E9%88%95%E5%8F%AF%E8%A6%8B...%E6%89%BE%E5%88%B0%E5%AE%83%E7%9A%84%E5%90%8D%E7%A8%B1...%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Click%20the%20Next%20button%20to%20get%20the%20password%20prompt.%22%20style%3D%22width%3A%20699px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Click%20the%20Next%20button%20to%20get%20the%20password%20prompt.%22%20style%3D%22width%3A%20699px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Click%20the%20Next%20button%20to%20get%20the%20password%20prompt.%22%20style%3D%22width%3A%20699px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Click%20the%20Next%20button%20to%20get%20the%20password%20prompt.%22%20style%3D%22width%3A%20699px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Click%20the%20Next%20button%20to%20get%20the%20password%20prompt.%22%20style%3D%22width%3A%20699px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F42309iF30697A8AB3DADEB%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22Capture5.PNG%22%20alt%3D%22Click%20the%20Next%20button%20to%20get%20the%20password%20prompt.%22%20%2F%3E%3Cspan%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EClick%20the%20Next%20button%20to%20get%20the%20password%20prompt.%3C%2Fspan%3E%3C%2Fspan%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EClick%20the%20Next%20button%20to%20get%20the%20password%20prompt.%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EClick%20the%20Next%20button%20to%20get%20the%20password%20prompt.%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EClick%20the%20Next%20button%20to%20get%20the%20password%20prompt.%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3E%E5%96%AE%E6%93%8A%E2%80%9C%E4%B8%8B%E4%B8%80%E6%AD%A5%E2%80%9D%E6%8C%89%E9%88%95%E4%BB%A5%E7%8D%B2%E5%8F%96%E5%AF%86%E7%A2%BC%E6%8F%90%E7%A4%BA%E3%80%82%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%E5%96%AE%E6%93%8A%E5%AE%83%EF%BC%8C%E7%84%B6%E5%BE%8C%E7%AD%89%E5%BE%85%E5%AF%86%E7%A2%BC%E5%AD%97%E6%AE%B5...%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3E%2F%2F%20click%20Next%20button%0Arc%20%3D%20clickID(%20%22idp-discovery-submit%22%20)%3B%0Aif(%20rc%20!%3D%20%22ok%22%2C%20throw(%22click%20submit%20user%20name%3A%20%22%7C%7Cchar(rc)))%3B%0A%0A%2F%2F%20wait%20for%20password%20field%0Arc%20%3D%20waitID(%20%22okta-signin-password%22%2C%205%20)%3B%0AIf(%20rc%20!%3D%20%22ok%22%2C%20Throw(%20%22no%20password%20field%3A%20%22%20%7C%7C%20char(rc)%20)%20)%3B%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%E7%84%B6%E5%BE%8C%E8%BC%B8%E5%85%A5%E5%AF%86%E7%A2%BC%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3E%2F%2F%20enter%20password%0Arc%20%3D%20keysToID(%20%22okta-signin-password%22%2C%20Include(%20%22%24documents%2Fpassword.jsl%22%20)%20)%3B%20%2F%2F%20file%20contains%20%22OpenSesame%22%2C%20in%20quotation%20marks%2C%20possibly%20encrypted%0Aif(%20rc%20!%3D%20%22ok%22%2C%20throw(%22keysToID%20password%3A%20%22%7C%7Cchar(rc)))%3B%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%E4%B8%A6%E9%87%8D%E8%A4%87%E8%A9%B2%E9%81%8E%E7%A8%8B...%E6%89%BE%E5%88%B0%E7%99%BB%E9%8C%84%E6%8C%89%E9%88%95...%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22After%20entering%20the%20password%2C%20click%20the%20sign%20in%20button.%22%20style%3D%22width%3A%20702px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22After%20entering%20the%20password%2C%20click%20the%20sign%20in%20button.%22%20style%3D%22width%3A%20702px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22After%20entering%20the%20password%2C%20click%20the%20sign%20in%20button.%22%20style%3D%22width%3A%20702px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22After%20entering%20the%20password%2C%20click%20the%20sign%20in%20button.%22%20style%3D%22width%3A%20702px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22After%20entering%20the%20password%2C%20click%20the%20sign%20in%20button.%22%20style%3D%22width%3A%20702px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F42310iC4A5D29F53B65B5E%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22Capture6.PNG%22%20alt%3D%22After%20entering%20the%20password%2C%20click%20the%20sign%20in%20button.%22%20%2F%3E%3Cspan%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EAfter%20entering%20the%20password%2C%20click%20the%20sign%20in%20button.%3C%2Fspan%3E%3C%2Fspan%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EAfter%20entering%20the%20password%2C%20click%20the%20sign%20in%20button.%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EAfter%20entering%20the%20password%2C%20click%20the%20sign%20in%20button.%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EAfter%20entering%20the%20password%2C%20click%20the%20sign%20in%20button.%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3E%E8%BC%B8%E5%85%A5%E5%AF%86%E7%A2%BC%E5%BE%8C%EF%BC%8C%E5%96%AE%E6%93%8A%E7%99%BB%E9%8C%84%E6%8C%89%E9%88%95%E3%80%82%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%E9%BB%9E%E6%93%8A%E5%AE%83%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3E%2F%2F%20click%20Sign%20In%0Arc%20%3D%20clickID(%20%22okta-signin-submit%22%20)%3B%0Aif(%20rc%20!%3D%20%22ok%22%2C%20throw(%22click%20signin%20submit%3A%20%22%7C%7Cchar(rc)))%3B%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%E6%88%91%E5%80%91%E5%B7%B2%E7%99%BB%E9%8C%84%E3%80%82%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Must%20be%20signed%20in%2C%20there%20is%20an%20edit%20profile%20choice.%22%20style%3D%22width%3A%20703px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Must%20be%20signed%20in%2C%20there%20is%20an%20edit%20profile%20choice.%22%20style%3D%22width%3A%20703px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Must%20be%20signed%20in%2C%20there%20is%20an%20edit%20profile%20choice.%22%20style%3D%22width%3A%20703px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Must%20be%20signed%20in%2C%20there%20is%20an%20edit%20profile%20choice.%22%20style%3D%22width%3A%20703px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Must%20be%20signed%20in%2C%20there%20is%20an%20edit%20profile%20choice.%22%20style%3D%22width%3A%20703px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F42311i2DF7CD25D9339244%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22Capture7.PNG%22%20alt%3D%22Must%20be%20signed%20in%2C%20there%20is%20an%20edit%20profile%20choice.%22%20%2F%3E%3Cspan%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EMust%20be%20signed%20in%2C%20there%20is%20an%20edit%20profile%20choice.%3C%2Fspan%3E%3C%2Fspan%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EMust%20be%20signed%20in%2C%20there%20is%20an%20edit%20profile%20choice.%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EMust%20be%20signed%20in%2C%20there%20is%20an%20edit%20profile%20choice.%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EMust%20be%20signed%20in%2C%20there%20is%20an%20edit%20profile%20choice.%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3E%E5%BF%85%E9%A0%88%E7%99%BB%E9%8C%84%EF%BC%8C%E6%9C%89%E4%B8%80%E5%80%8B%E7%B7%A8%E8%BC%AF%E5%80%8B%E4%BA%BA%E8%B3%87%E6%96%99%E9%81%B8%E9%A0%85%E3%80%82%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%E5%9C%96%E7%89%87%E4%B8%AD%E6%9C%89%E4%B8%80%E5%80%8B%E6%90%9C%E7%B4%A2%E5%AD%97%E6%AE%B5%EF%BC%8C%E8%BC%B8%E5%85%A5JSL%EF%BC%8C%E7%84%B6%E5%BE%8C%E5%96%AE%E6%93%8A%E6%94%BE%E5%A4%A7%E9%8F%A1%E3%80%82%20%E2%80%9CsearchField%E2%80%9D%E6%98%AF%20id%E3%80%82%20%E6%94%BE%E5%A4%A7%E9%8F%A1%E5%8F%AF%E4%BB%A5%E8%A2%AB%E5%96%AE%E6%93%8A%EF%BC%8C%E4%BD%86%20selenium%20%E6%9C%89%E4%B8%80%E5%80%8B%E6%8F%90%E4%BA%A4%E8%A1%A8%E5%96%AE%E6%A9%9F%E5%88%B6%EF%BC%8C%E5%8F%AF%E4%BB%A5%E5%9C%A8%20searchField%20%E4%B9%8B%E5%A4%96%E5%B7%A5%E4%BD%9C%EF%BC%8CsearchField%20%E6%98%AF%E8%A1%A8%E5%96%AE%E4%B8%AD%E7%9A%84%E8%BC%B8%E5%85%A5%E5%AD%97%E6%AE%B5%E3%80%82%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22The%20search%20field%20needs%20a%20bigger%20window%20to%20be%20visible%2C%20here%20it%20is.%22%20style%3D%22width%3A%20559px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22The%20search%20field%20needs%20a%20bigger%20window%20to%20be%20visible%2C%20here%20it%20is.%22%20style%3D%22width%3A%20559px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22The%20search%20field%20needs%20a%20bigger%20window%20to%20be%20visible%2C%20here%20it%20is.%22%20style%3D%22width%3A%20559px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22The%20search%20field%20needs%20a%20bigger%20window%20to%20be%20visible%2C%20here%20it%20is.%22%20style%3D%22width%3A%20559px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22The%20search%20field%20needs%20a%20bigger%20window%20to%20be%20visible%2C%20here%20it%20is.%22%20style%3D%22width%3A%20559px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F42314iBACE5B61EE8BB735%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22SearchField.PNG%22%20alt%3D%22The%20search%20field%20needs%20a%20bigger%20window%20to%20be%20visible%2C%20here%20it%20is.%22%20%2F%3E%3Cspan%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EThe%20search%20field%20needs%20a%20bigger%20window%20to%20be%20visible%2C%20here%20it%20is.%3C%2Fspan%3E%3C%2Fspan%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EThe%20search%20field%20needs%20a%20bigger%20window%20to%20be%20visible%2C%20here%20it%20is.%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EThe%20search%20field%20needs%20a%20bigger%20window%20to%20be%20visible%2C%20here%20it%20is.%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EThe%20search%20field%20needs%20a%20bigger%20window%20to%20be%20visible%2C%20here%20it%20is.%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3E%E6%90%9C%E7%B4%A2%E5%AD%97%E6%AE%B5%E9%9C%80%E8%A6%81%E6%9B%B4%E5%A4%A7%E7%9A%84%E7%AA%97%E5%8F%A3%E6%89%8D%E8%83%BD%E5%8F%AF%E8%A6%8B%EF%BC%8C%E5%B0%B1%E5%9C%A8%E9%80%99%E8%A3%A1%E3%80%82%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%E6%9C%89%E4%B8%80%E4%BA%9B%E7%95%B0%E6%AD%A5%20JavaScript%20%E5%8F%AF%E4%BB%A5%E5%8A%A0%E8%BC%89%E9%A0%81%E9%9D%A2%E7%9A%84%E6%9F%90%E4%BA%9B%E9%83%A8%E5%88%86%E3%80%82%20%E5%A6%82%E6%9E%9C%E5%AD%97%E6%AE%B5%E4%BD%9C%E7%82%BA%E9%A0%81%E9%9D%A2%E7%9A%84%E4%B8%80%E9%83%A8%E5%88%86%E5%8A%A0%E8%BC%89%EF%BC%8C%E5%89%87%E5%8F%AF%E8%83%BD%E4%B8%8D%E9%9C%80%E8%A6%81%E7%AD%89%E5%BE%85%E4%BB%BB%E4%BD%95%E7%89%B9%E5%AE%9A%E5%AD%97%E6%AE%B5%E3%80%82%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3E%2F%2F%203%3A%20query%20for%20articles%20about%20JSL%0A%0Arc%20%3D%20waitID(%20%22searchField%22%20)%3B%0AIf(%20rc%20!%3D%20%22ok%22%2C%20Throw(%20%22no%20search%20field%3A%20%22%20%7C%7C%20char(rc)%20)%20)%3B%0A%0A%2F%2F%20enter%20a%20search%20string.%20%22jsl%22%20currently%20retruns%203%20pages%0Arc%20%3D%20keysToID(%20%22searchField%22%2C%20%22jsl%22%20)%3B%0Aif(%20rc%20!%3D%20%22ok%22%2C%20throw(%22keysToID%20search%20field%3A%20%22%7C%7Cchar(rc)))%3B%0A%0AsubmitForm%20%3D%20Function(%20%7Bid%7D%2C%20%7Brc%7D%2C%0A%20%20%20%20Python%20Execute(%20%7Bid%7D%2C%20%7Brc%7D%2C%0A%22%5C%5B%0Atry%3A%0A%20%20%20%20driver.find_element(By.ID%2C%20id).submit()%0A%20%20%20%20rc%20%3D%20%22ok%22%0Aexcept%20Exception%20as%20e%3A%0A%20%20%20%20rc%20%3D%20repr(e)%0A%5D%5C%22%0A%20%20%20%20)%3B%0A%20%20%20%20return(rc)%3B%0A)%3B%0Arc%20%3D%20submitForm(%20%22searchField%22%20)%3B%20%2F%2F%20submit%20form%20works%20OK%20off%20of%20this%20input%20field.%0Aif(%20rc%20!%3D%20%22ok%22%2C%20throw(%22submitForm%20searchField%3A%20%22%7C%7Cchar(rc)))%3B%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%E7%8F%BE%E5%9C%A8%E6%BA%96%E5%82%99%E5%A5%BD%E7%BF%BB%E9%96%B1%E7%B5%90%E6%9E%9C%E3%80%82%20%E5%A4%9A%E9%A0%81%E5%88%97%E8%A1%A8%E5%85%83%E7%B4%A0%E5%A6%82%E4%B8%8B%E6%89%80%E7%A4%BA%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22The%20pink%20outer%20element%20holds%20three%20inner%20parts%3A%20title%2C%20description%2C%20link.%22%20style%3D%22width%3A%20700px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22The%20pink%20outer%20element%20holds%20three%20inner%20parts%3A%20title%2C%20description%2C%20link.%22%20style%3D%22width%3A%20700px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22The%20pink%20outer%20element%20holds%20three%20inner%20parts%3A%20title%2C%20description%2C%20link.%22%20style%3D%22width%3A%20700px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22The%20pink%20outer%20element%20holds%20three%20inner%20parts%3A%20title%2C%20description%2C%20link.%22%20style%3D%22width%3A%20700px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22The%20pink%20outer%20element%20holds%20three%20inner%20parts%3A%20title%2C%20description%2C%20link.%22%20style%3D%22width%3A%20700px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F42312i8A551F346E9ADCA7%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22Capture8.PNG%22%20alt%3D%22The%20pink%20outer%20element%20holds%20three%20inner%20parts%3A%20title%2C%20description%2C%20link.%22%20%2F%3E%3Cspan%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EThe%20pink%20outer%20element%20holds%20three%20inner%20parts%3A%20title%2C%20description%2C%20link.%3C%2Fspan%3E%3C%2Fspan%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EThe%20pink%20outer%20element%20holds%20three%20inner%20parts%3A%20title%2C%20description%2C%20link.%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EThe%20pink%20outer%20element%20holds%20three%20inner%20parts%3A%20title%2C%20description%2C%20link.%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EThe%20pink%20outer%20element%20holds%20three%20inner%20parts%3A%20title%2C%20description%2C%20link.%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3E%E7%B2%89%E8%89%B2%E5%A4%96%E9%83%A8%E5%85%83%E7%B4%A0%E5%8C%85%E5%90%AB%E4%B8%89%E5%80%8B%E5%85%A7%E9%83%A8%E9%83%A8%E5%88%86%EF%BC%9A%E6%A8%99%E9%A1%8C%E3%80%81%E6%8F%8F%E8%BF%B0%E3%80%81%E9%8F%88%E6%8E%A5%E3%80%82%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%E6%9C%89%E4%B8%80%E5%80%8B%E8%B7%A8%E8%B6%8A%E5%A4%9A%E5%80%8B%E9%A0%81%E9%9D%A2%E7%9A%84%E7%B2%89%E8%89%B2%E5%9C%93%E5%9C%88%E6%95%B8%E6%93%9A%E9%A0%85%E5%88%97%E8%A1%A8%E3%80%82%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3E%2F%2F%204%3A%20page%20through%20the%20results%20to%20capture%20them%0A%0AgetElements%20%3D%20Function(%20%7Bid%2C%20BYformat%3DBy_ID%7D%2C%20%7Brc%7D%2C%0A%20%20%20%20Python%20Execute(%20%7Bid%2C%20BYformat%7D%2C%20%20%7Brc%7D%2C%0A%22%5C%5B%0Atry%3A%0A%20%20%20%20list%20%3D%20driver.find_elements(BYformat%2Cid)%0A%20%20%20%20rc%20%3D%20%22ok%22%0Aexcept%20Exception%20as%20e%3A%0A%20%20%20%20rc%20%3D%20repr(e)%0A%5D%5C%22%0A%20%20%20%20)%3B%0A%20%20%20%20Return(%20rc%20)%3B%0A)%3B%0A%0AgetNElements%20%3D%20function(%7B%7D%2C%7Bn%7D%2C%0A%20%20%20%20Python%20Execute(%20%7B%7D%2C%20%7Bn%7D%2C%0A%22%5C%5B%0Atry%3A%0A%20%20%20%20n%20%3D%20len(list)%0Aexcept%20Exception%20as%20e%3A%0A%20%20%20%20print(repr(e))%0A%20%20%20%20n%20%3D%20-1%0A%5D%5C%22%0A%20%20%20%20)%3B%20%0A%20%20%20%20return(n)%3B%0A)%3B%0A%0AgetElementItext%20%3D%20function(%7Bi%2Cid%2C%20BYformat%3DBy_ID%7D%2C%7Btxt%7D%2C%0A%20%20%20%20Python%20Execute(%20%7Bi%2C%20id%2C%20BYformat%7D%2C%20%7Btxt%7D%2C%0A%22%5C%5B%0Atry%3A%0A%20%20%20%20txt%20%3D%20list%5Bint(i)%5D.find_element(BYformat%2C%20id).text%0Aexcept%20Exception%20as%20e%3A%0A%20%20%20%20txt%20%3D%20%22Error%3A%20getElementItext%3A%20%22%20%2B%20repr(e)%0A%5D%5C%22%0A%20%20%20%20)%3B%20%0A%20%20%20%20return(txt)%3B%0A)%3B%0A%0AgetElementIattribute%20%3D%20function(%7Bi%2Cid%2C%20BYformat%3DBy_ID%2C%20attr%7D%2C%7Btxt%7D%2C%0A%20%20%20%20Python%20Execute(%20%7Bi%2C%20id%2C%20BYformat%2C%20attr%7D%2C%20%7Btxt%7D%2C%0A%22%5C%5B%0Atry%3A%0A%20%20%20%20txt%20%3D%20list%5Bint(i)%5D.find_element(BYformat%2C%20id).get_attribute(attr)%0Aexcept%20Exception%20as%20e%3A%0A%20%20%20%20txt%20%3D%20%22Error%3A%20getElementIattribute%3A%20%22%20%2B%20repr(e)%0A%5D%5C%22%0A%20%20%20%20)%3B%20%0A%20%20%20%20return(txt)%3B%0A)%3B%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%E4%B8%8A%E5%9C%96%EF%BC%9A%E4%B8%8B%E9%9D%A2%E5%BE%AA%E7%92%B0%E4%B8%AD%E4%BD%BF%E7%94%A8%E7%9A%84%E4%B8%80%E4%BA%9B%E5%87%BD%E6%95%B8%E3%80%82%20%E9%A0%81%E9%9D%A2%E5%BA%95%E9%83%A8%E6%9C%89%E6%8C%89%E9%88%95%E5%8F%AF%E4%BB%A5%E9%80%B2%E5%85%A5%E4%B8%8B%E4%B8%80%E9%A0%81%EF%BC%9B%E4%BB%96%E5%80%91%E9%81%8B%E8%A1%8C%E4%B8%80%E4%BA%9B%20JavaScript%20%E4%BE%86%E9%8A%B7%E6%AF%80%E4%B8%A6%E9%87%8D%E6%96%B0%E5%89%B5%E5%BB%BA%E9%A0%85%E7%9B%AE%E5%88%97%E8%A1%A8%E3%80%82%20%E5%86%8D%E6%AC%A1%E8%AA%BF%E7%94%A8%E9%80%99%E4%BA%9B%E5%87%BD%E6%95%B8%E4%BB%A5%E9%87%8D%E6%96%B0%E6%8D%95%E7%8D%B2%E6%96%B0%E5%88%97%E8%A1%A8%E3%80%82%20%E5%B0%8D%E6%96%BC%E6%9C%AC%E7%A4%BA%E4%BE%8B%E4%BE%86%E8%AA%AA%EF%BC%8CJSL%20%E5%92%8C%20Python%20%E5%B7%B2%E7%B6%93%E8%B6%B3%E5%A4%A0%E4%BA%86%E3%80%82%20%E5%A6%82%E6%9E%9C%E6%9C%89%E5%A4%9A%E5%80%8B%E5%88%97%E8%A1%A8%E9%9C%80%E8%A6%81%E5%90%8C%E6%99%82%E8%B7%9F%E8%B8%AA%EF%BC%8C%E5%AE%83%E5%80%91%E5%B0%B1%E6%9C%83%E5%B4%A9%E6%BD%B0%E2%80%94%E2%80%94%E5%8F%83%E8%A6%8B%20Python%3CEM%3E%E5%88%97%E8%A1%A8%3C%2FEM%3E%E5%A4%9A%E8%AE%8A%E7%9A%84%E3%80%82%20%E6%88%91%E5%BE%88%E7%A2%BA%E5%AE%9A%E6%9C%89%E5%BF%85%E8%A6%81%E5%9C%A8%E6%AF%8F%E5%80%8B%E4%B8%8B%E4%B8%80%E9%A0%81%E4%B9%8B%E5%BE%8C%E7%AD%89%E5%BE%85%E6%95%B8%E6%93%9A%E5%8A%A0%E8%BC%89......%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3Edt%20%3D%20New%20Table(%20%22articles%22%2C%0A%20%20%20%20New%20Column(%20%22link%22%2C%20character%2C%0A%20%20%20%20%20%20%20%20Set%20Property(%22Event%20Handler%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20Event%20Handler(%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20Click(JSL%20Quote(Function(%20%7BthisTable%2C%20thisColumn%2C%20iRow%7D%2C%20Web(%20Char(%20thisTable%3AthisColumn%5B%20iRow%20%5D%20)%20)%3B%20)%3B))%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20Tip(JSL%20Quote(Function(%20%7BthisTable%2C%20thisColumn%2C%20iRow%7D%2C%20%22Open%20%22%20%7C%7C%20Char(%20thisTable%3AthisColumn%5B%20iRow%20%5D%20)%20%7C%7C%20%22%20in%20your%20browser.%22%3B%20)%3B))%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20Color(JSL%20Quote(Function(%20%7BthisTable%2C%20thisColumn%2C%20iRow%7D%2C%20RGBColor(%22link%22)%3B%20)%3B))%0A%20%20%20%20%20%20%20%20%20%20%20%20)%0A%20%20%20%20%20%20%20%20)%0A%20%20%20%20)%2C%0A%20%20%20%20New%20Column(%20%22title%22%2C%20character%20)%2C%0A%20%20%20%20New%20Column(%20%22description%22%2C%20character%20)%0A)%3B%0A%0A%2F%2F%20this%20while%20loop%20will%20grab%20screens%20of%20answers%20and%20break()%20when%20the%20NextScreen%20button%20goes%20dim%0Awhile(1%2C%0A%20%20%20%20%2F%2F%20not%20sure%2C%20yet%2C%20what%20to%20wait%20for.%20maybe%20the%20card(s)...%0A%20%20%20%20%2F%2F%20this%20html%20is%20updated%20in%20the%20background%20by%20a%20json%20ajax%20mechanism%20that%0A%20%20%20%20%2F%2F%20is%20hard%20to%20see.%20%0A%20%20%20%20rc%20%3D%20waitID(%22%2F%2Fdiv%5B%40id%3D'searchresults'%5D%2F%2Fdiv%5B%40class%3D'result-card'%5D%22%2C10%2CBy_XPATH)%3B%0A%20%20%20%20If(%20rc%20!%3D%20%22ok%22%2C%20Throw(%20%22no%20search%20results%22%20)%20)%3B%0A%20%20%20%20%0A%20%20%20%20%2F%2F%20get%20the%20current%20set%0A%20%20%20%20rc%20%3D%20getElements(%22%2F%2Fdiv%5B%40id%3D'searchresults'%5D%2F%2Fdiv%5B%40class%3D'result-card'%5D%22%2CBy_XPATH)%3B%0A%20%20%20%20if(%20rc%20!%3D%20%22ok%22%2C%20throw(%22getElements%3A%20%22%7C%7Cchar(rc)))%3B%0A%20%20%20%20n%20%3D%20getNElements()%3B%0A%20%20%20%20for(i%3D0%2Ci%3CN%3E%3C%2FN%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%E6%AD%A4%E6%99%82%E7%80%8F%E8%A6%BD%E5%99%A8%E5%B7%B2%E6%89%93%E9%96%8B%EF%BC%8C%E4%B8%A6%E4%B8%94%E8%A9%B2%E8%A1%A8%E9%A1%AF%E7%A4%BA%E5%9C%A8%E5%B1%8F%E5%B9%95%E4%B8%8A%E3%80%82%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Today%20there%20were%2057%20entries%20spanning%20three%20pages.%22%20style%3D%22width%3A%20763px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Today%20there%20were%2057%20entries%20spanning%20three%20pages.%22%20style%3D%22width%3A%20763px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Today%20there%20were%2057%20entries%20spanning%20three%20pages.%22%20style%3D%22width%3A%20763px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Today%20there%20were%2057%20entries%20spanning%20three%20pages.%22%20style%3D%22width%3A%20763px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Today%20there%20were%2057%20entries%20spanning%20three%20pages.%22%20style%3D%22width%3A%20763px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F42313i26446DF8CA3D6401%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22Capture9.PNG%22%20alt%3D%22Today%20there%20were%2057%20entries%20spanning%20three%20pages.%22%20%2F%3E%3Cspan%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EToday%20there%20were%2057%20entries%20spanning%20three%20pages.%3C%2Fspan%3E%3C%2Fspan%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EToday%20there%20were%2057%20entries%20spanning%20three%20pages.%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EToday%20there%20were%2057%20entries%20spanning%20three%20pages.%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EToday%20there%20were%2057%20entries%20spanning%20three%20pages.%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3E%E4%BB%8A%E5%A4%A9%EF%BC%8C%E4%B8%89%E9%A0%81%E7%B4%99%E4%B8%8A%E6%9C%89%2057%20%E5%80%8B%E6%A2%9D%E7%9B%AE%E3%80%82%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%E6%98%AF%E6%99%82%E5%80%99%E9%97%9C%E9%96%89%E7%80%8F%E8%A6%BD%E5%99%A8%E4%BA%86%E3%80%82%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3E%2F%2F%205%3A%20quit%0A%20%0APython%20Submit(%20%0A%22%5C%5B%0Adriver.quit()%20%23%20close%20the%20browser%0A%5D%5C%22%20)%3B%0APython%20Term()%3B%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%E6%9C%80%E5%BE%8C%E6%9C%89%E4%B8%80%E5%80%8B%20XPATH%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-jsl%22%3E%3CCODE%3Erc%20%3D%20clickID(%22%2F%2Ful%5B%40id%3D'pager'%5D%2F%2Fa%5B%40class%3D'pager-next'%5D%22%2CBy_XPATH)%3B%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%E9%80%99%E6%84%8F%E5%91%B3%E8%91%97%3C%2FP%3E%0A%3CPRE%3E%2F%2F%20-%20somewhere%20below%20the%20root%20of%20the%20document%20find%20a%0Aul%20-%20a%20%26lt%3Bul%26gt%3B%20tag%20(some%20sort%20of%20HTML%20list)%0A%5B%40id%3D'pager'%5D%20-%20the%20list%20has%20this%20id%0A%2F%2F%20-%20more%20nested%20tags%2C%20followed%20by...%0Aa%20%3D%20a%20%26lt%3Ba%26gt%3B%20tag%20(link)%0A%5B%40class%3D'pager-next'%5D%3C%2FPRE%3E%0A%3CP%3E%E5%8F%AF%E8%83%BD%E4%B8%8D%E9%9C%80%E8%A6%81%E9%82%A3%E9%BA%BC%E8%A4%87%E9%9B%9C%E3%80%82%20%E9%80%99%E6%98%AF%E4%B8%80%E5%80%8B%E4%BD%BF%E7%94%A8%E5%94%AF%E4%B8%80%20id%20%E4%BE%86%E6%9F%A5%E6%89%BE%E5%A6%82%E6%9E%9C%E5%83%85%E8%80%83%E6%85%AE%E9%A1%9E%E5%89%87%E5%8F%AF%E8%83%BD%E4%B8%8D%E5%94%AF%E4%B8%80%E7%9A%84%E9%A0%85%E7%9B%AE%E7%9A%84%E7%A4%BA%E4%BE%8B%E3%80%82%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-485000%22%20slang%3D%22en-US%22%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22FoxMarionette.png%22%20style%3D%22width%3A%20800px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22FoxMarionette.png%22%20style%3D%22width%3A%20800px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22FoxMarionette.png%22%20style%3D%22width%3A%20800px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22FoxMarionette.png%22%20style%3D%22width%3A%20800px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22FoxMarionette.png%22%20style%3D%22width%3A%20800px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F42303i444F7DB5916F7F39%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22FoxMarionette.png%22%20alt%3D%22FoxMarionette.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%E4%BD%BF%E7%94%A8%20JSL%20%E6%8E%A7%E5%88%B6%20Web%20%E7%80%8F%E8%A6%BD%E5%99%A8%E3%80%82%3C%2FP%3E%3C%2FLINGO-TEASER%3E
Choose Language Hide Translation Bar
Craige_Hales
Super User
Browser Scripting with Python Selenium

Much of the web uses restful APIs to move data to and from servers. Rest is a simple concept that has nothing to do with sleeping; rest means representational state transfer, but this article is not about rest. This article is about a kludgy mechanism for working around the lack of a rest API when you really need to retrieve some data from a site.

 

Web sites might not want you to do this for various reasons: bandwidth for data costs money, data licensing costs money, and not watching the advertisements might cost money too. This tool, selenium, is nominally for testing a web site, not for speeding over a speed bump. Most sites have terms of use; you can find JMP's terms at the bottom of this page.

 

A complete JSL file is attached. It is written for Firefox, Windows, and the JMP web site as it looked on 8May2022. The Firefox part can be changed, probably, to many other browsers. It might work on Mac too, no testing was done. The JMP web site will change over time and the JSL will need tweaking. That's the downside of not using an official API.

 

Before starting, download a driver and install selenium as shown in the comments below. You'll need Firefox too, or do some research on the driver for your preferred browser.

 

// JMP + Python + Selenium + Firefox (probably works with Chrome or Edge with a few tweaks)
// https://firefox-source-docs.mozilla.org/testing/geckodriver/index.html
// https://selenium-python.readthedocs.io/

// downloaded            https://github.com/mozilla/geckodriver/releases    -- geckodriver-...-win64.zip (pick latest)
// expand                on desktop   geckodriver.exe
// installed selenium    python -m pip install selenium

// the following code is welded into the JMP.COM's HTML of 8May2022. It could change at anytime.
// the functions are sprinkled through the JSL below, near where I first needed them, reused later.
// you'll need similar functions, probably, and want to consult the Python Selenium bindings to write them.
// I only wrote enough to make this simple example work. There is no actual need to be logged in to JMP.
//
// Using try...except on snips of python code makes debugging much easier. JMP loses the exception message without it.
//
// the JSL functions are thin wrappers around the python calls to selenium which (I believe) is
// a thin wrapper to generate an API call to the gecko (etc) driver. I *think* it might be possible to
// remove the python layer and load/call the driver directly from JSL. But Selenium is documented.

Python Init(); // one-time startup...

// 0: startup 

xrc = Python Execute( {}, {By_ID, By_XPATH, rc},
"\[
try:
    from selenium import webdriver
    from selenium.common.exceptions import TimeoutException
    from selenium.webdriver.support.ui import WebDriverWait
    from selenium.webdriver.support import expected_conditions as EC
    from selenium.webdriver.common.keys import Keys
    from selenium.webdriver.common.by import By
    from selenium.webdriver.firefox.service import Service
    from selenium.webdriver.firefox.options import Options
    #
    options = webdriver.FirefoxOptions()
    #options.add_argument("--private") # example. you most likely don't want private, some things don't work.
    #
    service=Service(r'C:\Users\v1\Desktop\geckodriver.exe')
    # sometimes people use "browser" rather than "driver". It will be used below.
    driver = webdriver.Firefox(service=service,options=options)
    # return two magic values. you may need some others, just add them in the same way...
    By_ID = By.ID
    By_XPATH = By.XPATH
    rc = "ok"
except Exception as e:
    rc = repr(e)
]\"
);

If( xrc != 0 | rc != "ok", Throw( "start up Selenium failed" || Try( ": " || Char( rc ), "" ) ) );

 

The PythonInit() only needs to be done once; it connects JMP to Python and takes a few seconds the first time. You can call it again with no penalty. The PythonExecute(...) sends no variables in but gets three back from the code it runs. It takes a bit to load everything and start the browser.

 

You are looking at an empty browser controlled by JMPYou are looking at an empty browser controlled by JMP

 

Open the JMP.COM page next. You might see a redirect that normally goes unnoticed.

 

// 1: navigate to jmp.com

nav = Function( {url}, {rc},
    Python Execute( {url}, {rc}, 
"\[
try:
    driver.get(url)
    rc = "ok"
except Exception as e:
    rc = repr(e)
]\" );
    return(rc);
);

rc = nav( "https://www.jmp.com/" );
if( rc != "ok", throw("nav: "||char(rc)));

 

The nav function returns "ok" or an error message. The JMP web page loads in the browser. Ignore the people in the screenshot.

 

The icon means the browser is remote controlled.The icon means the browser is remote controlled.

 

Script the sign-in to the JMP site. Right-click the Sign in button to find out the button's HTML id value. Remember how to do this; I'll skip this explanation at the end...

 

F12 might bring you to the next screen, but this way the control will already be selected.F12 might bring you to the next screen, but this way the control will already be selected.

 

And the developer console opens with the control's id showing. Further down there will be controls that have a class but not an id. Selenium's XPATH can handle it. The trick is similar to displaybox navigation--finding a path that is not too brittle and still specific enough.

 

Use the button id in the JSL that follows.Use the button id in the JSL that follows.

 

IDs are usually the best choice when available because they are unique on the page. WaitID waits for up to 10 seconds for the login button to appear. It might not be necessary to wait. It takes no time if it is already there.

 

// 2: login with userid/password credentials

// wait for an id to be available
waitID = Function( {id, timeout = 10, BYformat=By_ID}, {rc},
    Python Execute( {id, timeout, BYformat},  {rc},
"\[
try:
    myElem = WebDriverWait(driver, timeout).until(EC.presence_of_element_located((BYformat, id)))
    rc = "ok"
except TimeoutException:
    rc = "timeout"
except Exception as e:
    rc = repr(e)
]\"
    );
    Return( rc );
);
rc = waitID( "loginButton", 5 );
If( rc != "ok", Throw( "no login button: " || char(rc) ) );

// click a button ID
clickID = Function( {id, BYformat=By_ID}, {rc},
    Python Execute( {id, BYformat}, {rc},
"\[
try:
    driver.find_element(BYformat, id).click()
    rc = "ok"
except Exception as e:
    rc = repr(e)
]\"
    );
    return(rc);
);
rc = clickID( "loginButton" );
if( rc != "ok", throw("login button: "||char(rc)));

 

Cool! The sign on screen pops up. Find the user name field next.

 

Now get the id for the user name field by right-click...Now get the id for the user name field by right-click...

 

Again, wait for the expected field. Now a keystroke function is needed...

 

rc = waitID( "idp-discovery-username", 10 );
If( rc != "ok", Throw( "no username field: " || char(rc) ) );

// type a value into a field
keysToID = Function( {id, txt}, {rc},
    Python Execute( {id, txt}, {rc},
"\[
try:
    driver.find_element(By.ID, id).send_keys(txt)
    rc = "ok"
except Exception as e:
    rc = repr(e)
]\"
    );
    return(rc);
);
rc = keysToID( "idp-discovery-username", Include( "$documents/UserID.jsl" ) ); // file contains "AliBaba@1000&OneNights.com", in quotation marks, possibly encrypted
if( rc != "ok", throw("keysToID username: "||char(rc)));

 

Fake user name for fake password.Fake user name for fake password.

 

My userid is scrolled off the screen and the next button is visible...find its name...

 

Click the Next button to get the password prompt.Click the Next button to get the password prompt.

 

click it, then wait for the password field...

 

// click Next button
rc = clickID( "idp-discovery-submit" );
if( rc != "ok", throw("click submit user name: "||char(rc)));

// wait for password field
rc = waitID( "okta-signin-password", 5 );
If( rc != "ok", Throw( "no password field: " || char(rc) ) );

 

then enter the password

 

// enter password
rc = keysToID( "okta-signin-password", Include( "$documents/password.jsl" ) ); // file contains "OpenSesame", in quotation marks, possibly encrypted
if( rc != "ok", throw("keysToID password: "||char(rc)));

and repeat the process...find the sign in button...

 

After entering the password, click the sign in button.After entering the password, click the sign in button.

 

click it

 

// click Sign In
rc = clickID( "okta-signin-submit" );
if( rc != "ok", throw("click signin submit: "||char(rc)));

 

We are signed in.

 

Must be signed in, there is an edit profile choice.Must be signed in, there is an edit profile choice.

 

There is a search field in the picture, Type in JSL and click the magnifier. "searchField" is the id. The magnifier could be clicked, but selenium has a submit form mechanism that will work off the searchField, which is an input field in the form.

 

The search field needs a bigger window to be visible, here it is.The search field needs a bigger window to be visible, here it is.

 

There is some asynchronous JavaScript that loads some parts of the page. Waiting for any particular field might not be necessary if the field is loaded as part of the page.

 

// 3: query for articles about JSL

rc = waitID( "searchField" );
If( rc != "ok", Throw( "no search field: " || char(rc) ) );

// enter a search string. "jsl" currently retruns 3 pages
rc = keysToID( "searchField", "jsl" );
if( rc != "ok", throw("keysToID search field: "||char(rc)));

submitForm = Function( {id}, {rc},
    Python Execute( {id}, {rc},
"\[
try:
    driver.find_element(By.ID, id).submit()
    rc = "ok"
except Exception as e:
    rc = repr(e)
]\"
    );
    return(rc);
);
rc = submitForm( "searchField" ); // submit form works OK off of this input field.
if( rc != "ok", throw("submitForm searchField: "||char(rc)));

 

Now get ready to page through the results. The multi-page listing elements look like this

 

The pink outer element holds three inner parts: title, description, link.The pink outer element holds three inner parts: title, description, link.

 

there is a list of the pink-circled data items that spans multiple pages.

 

// 4: page through the results to capture them

getElements = Function( {id, BYformat=By_ID}, {rc},
    Python Execute( {id, BYformat},  {rc},
"\[
try:
    list = driver.find_elements(BYformat,id)
    rc = "ok"
except Exception as e:
    rc = repr(e)
]\"
    );
    Return( rc );
);

getNElements = function({},{n},
    Python Execute( {}, {n},
"\[
try:
    n = len(list)
except Exception as e:
    print(repr(e))
    n = -1
]\"
    );	
    return(n);
);

getElementItext = function({i,id, BYformat=By_ID},{txt},
    Python Execute( {i, id, BYformat}, {txt},
"\[
try:
    txt = list[int(i)].find_element(BYformat, id).text
except Exception as e:
    txt = "Error: getElementItext: " + repr(e)
]\"
    );	
    return(txt);
);

getElementIattribute = function({i,id, BYformat=By_ID, attr},{txt},
    Python Execute( {i, id, BYformat, attr}, {txt},
"\[
try:
    txt = list[int(i)].find_element(BYformat, id).get_attribute(attr)
except Exception as e:
    txt = "Error: getElementIattribute: " + repr(e)
]\"
    );	
    return(txt);
);

 

Above: some functions to use in the loop below. There are buttons at the bottom of the page to go to the next page; they run some JavaScript that destroys and recreates the list of items. The functions are called again to recapture the new list. The JSL and Python are good enough for this example. They will break down if there is more than one list to keep track of at the same time--see the Python list variable. I'm pretty sure it is necessary to wait for the data to load after each next page...

 

dt = New Table( "articles",
    New Column( "link", character,
        Set Property("Event Handler",
            Event Handler(
                Click(JSL Quote(Function( {thisTable, thisColumn, iRow}, Web( Char( thisTable:thisColumn[ iRow ] ) ); );)),
                Tip(JSL Quote(Function( {thisTable, thisColumn, iRow}, "Open " || Char( thisTable:thisColumn[ iRow ] ) || " in your browser."; );)),
                Color(JSL Quote(Function( {thisTable, thisColumn, iRow}, RGBColor("link"); );))
            )
        )
    ),
    New Column( "title", character ),
    New Column( "description", character )
);

// this while loop will grab screens of answers and break() when the NextScreen button goes dim
while(1,
    // not sure, yet, what to wait for. maybe the card(s)...
    // this html is updated in the background by a json ajax mechanism that
    // is hard to see. 
    rc = waitID("//div[@id='searchresults']//div[@class='result-card']",10,By_XPATH);
    If( rc != "ok", Throw( "no search results" ) );
    
    // get the current set
    rc = getElements("//div[@id='searchresults']//div[@class='result-card']",By_XPATH);
    if( rc != "ok", throw("getElements: "||char(rc)));
    n = getNElements();
    for(i=0,i<n,i+=1,
        // fetch the elements
        dt<<addrows(1);
        dt:title[nrows(dt)] = getElementItext(i,"a[@class='result-title_txt_all']",By_XPATH);
        dt:description[nrows(dt)] = getElementItext(i,"section[@class='result-description_txt_all']",By_XPATH);
        dt:link[nrows(dt)] = getElementIattribute(i,"a[@class='result-url']",By_XPATH,"href");
    );
     
    // advance to next page via pager-next button within the id=pager
    rc = waitID("//ul[@id='pager']//a[@class='pager-next']",1,By_XPATH);
    if(rc != "ok", // check for end vs error
        rc = waitID("//ul[@id='pager']//span[@class='pager-disabled pager-next']",1,By_XPATH);
        if(rc=="ok", break(/*normal exit with disabled span*/), throw("did not find expected pager button disabled"));
    ,//
        rc = clickID("//ul[@id='pager']//a[@class='pager-next']",By_XPATH);
        if( rc != "ok", throw("click pager next: "||char(rc)));
    );
    
);

 

At this point the browser is open and this table is on the screen.

 

Today there were 57 entries spanning three pages.Today there were 57 entries spanning three pages.

 

Time to shut down the browser.

 

// 5: quit
 
Python Submit( 
"\[
driver.quit() # close the browser
]\" );
Python Term();

 

Towards the end there is an XPATH

 

 

rc = clickID("//ul[@id='pager']//a[@class='pager-next']",By_XPATH);

 

 

that means

// - somewhere below the root of the document find a
ul - a <ul> tag (some sort of HTML list)
[@id='pager'] - the list has this id
// - more nested tags, followed by...
a = a <a> tag (link)
[@class='pager-next']

It might not need to be that complicated. It is an example that uses a unique id to find an item that might not be unique if only the class was considered.

Last Modified: May 8, 2022 10:01 PM