ν‹°μŠ€ν† λ¦¬ λ·°

728x90
λ°˜μ‘ν˜•
μ…€λ ˆλ‹ˆμ›€μ„ 톡해 μžλ™ν™”ν•˜λ‹€ 보면, 정보 μˆ˜μ§‘μ„ μœ„ν•œ μžλ™ν™”λ„ μžˆμ§€λ§Œ ν‹°μΌ“νŒ… ν›„ νŠΉμ • ν”„λ‘œκ·Έλž¨ μ‹€ν–‰ λ˜λŠ” κ²Œμž„ μžλ™ μ‹€ν–‰ λ“± λ‹€μ–‘ν•˜κ²Œ μ‚¬μš©λ  수 μžˆλ‹€. 그쀑에 제λͺ©κ³Ό 같이 νŠΉμ • ν”„λ‘œκ·Έλž¨μ„ μ—¬μ‹œκ² μŠ΅λ‹ˆκΉŒ?λΌλŠ” 문ꡬ가 μ…€λ ˆλ‹ˆμ›€ μƒμ—μ„œλŠ” μ»¨νŠΈλ‘€λ˜μ§€ μ•Šμ•„ κΆκΈˆν•΄μ„œ μ°Ύμ•„λ³΄κ²Œ λ˜μ—ˆλ‹€.

 

λ‹€λ₯Έ μ‚¬λžŒλ“€λ„ κ·ΈλŸ°μ§€ μ°Ύμ•„λ³΄μž

μžλ™ν™”ν• λ•Œ ν‚Ήλ°›λŠ” μ—¬μ‹œκ² μŠ΅λ‹ˆκΉŒ νŒμ—…μ°½

 

Selenium Python getting around "Open <...>.app?"

I am trying to write e2e tests for a Slack bot and while logging in via browser it always asks whether I'd like to use the Slack desktop app instead of continuing with the browser (its Chrome by th...

stackoverflow.com

 

 μ΄λ¦¬ 저리 κ²€μƒ‰ν•΄λ³΄λ‹ˆ, ν•΄λ‹Ή νŒμ—…μ°½μ€ μ…€λ ˆλ‹ˆμ›€ μƒμ—μ„œλŠ” μ»¨νŠΈλ‘€ν•  수 μ—†κ³  OSμ—μ„œ μ»¨νŠΈλ‘€ν•΄μ•Ό λœλ‹€λŠ” μ˜κ²¬λ“€μ΄ λ§Žμ•˜λ‹€. λ§Žμ€ 검색을 ν•œ 것은 μ•„λ‹ˆλΌμ„œ ν™•μ‹€μΉ˜λŠ” μ•Šλ‹€.πŸ˜₯ κ°€μž₯ κ°„λ‹¨ν•œ λ°©λ²•μœΌλ‘œλŠ” ν‚€λ³΄λ“œλ₯Ό μ™Όμͺ½ 2번, μ—”ν„° ν•œλ²ˆ λˆ„λ₯΄λ©΄ Open을 선택할 수 μžˆλ‹€. 이λ₯Ό μœ„ν•΄ `pyautogui`λ₯Ό μ‚¬μš©ν•˜λ©΄ λœλ‹€.

 

κ°„λ‹¨ν•œ 예제

import time
from pyautogui import press


# νŒμ—…μ°½μ΄ 뜬 μƒν™©μ—μ„œ ν•΄λ‹Ή ν•¨μˆ˜ μ‹€ν–‰.
def click_open():
    time.sleep(2)
    press('left', presses=1)
    press('enter', presses=1)

 `sleep`을 κ±Έμ–΄μ£ΌλŠ” μ΄μœ λŠ” λ„ˆλ¬΄ 빨리 ν‚€λ³΄λ“œλ₯Ό λˆ„λ₯΄κ²Œ 되면, open νŒμ—… 창이 λœ¨κΈ°μ „μ— ν‚€λ³΄λ“œλ₯Ό λˆ„λ₯΄κ²Œ λ˜λŠ” 상황이 λ°œμƒν•œλ‹€. λ˜ν•œ μ˜€ν”ˆλœ μƒνƒœμ—μ„œ ν‚€λ³΄λ“œλ₯Ό 눌러 λ²„νŠΌμ„ μ„ νƒν•˜λŠ” κ³Όμ •μ΄λ―€λ‘œ webdriver μ˜΅μ…˜ 쀑 ν•˜λ‚˜μΈ, `--headless` μ˜΅μ…˜μ„ μ‚¬μš©ν•  수 μ—†λ‹€.

728x90
λ°˜μ‘ν˜•
λŒ“κΈ€
κΈ€ 보관함
μ΅œκ·Όμ— 올라온 κΈ€
μ΅œκ·Όμ— 달린 λŒ“κΈ€