¶}µoªÌ¤u¨ãselenium+vba¥Î©óºô¶§ì¨ú¸ê®Æªº°ÝÃD
- ©«¤l
- 354
- ¥DÃD
- 5
- ºëµØ
- 0
- ¿n¤À
- 387
- ÂI¦W
- 0
- §@·~¨t²Î
- windows7
- ³nÅ骩¥»
- vba,vb,excel2007
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2017-1-8
- ³Ì«áµn¿ý
- 2024-8-2
|
¶}µoªÌ¤u¨ãselenium+vba¥Î©óºô¶§ì¨ú¸ê®Æªº°ÝÃD
¥Ø«eµ{¦¡¥i¥H¥¿±`¹B¦æ
·Q°Ý´XÓ³¡¤À°ÝÃD
1.¦pªG§Ú¤£¥Îsendkeyªº¤è¦¡,¥i§_¥¿±`ªº±Nºô¶·í«e¶±ªº©Ò¦³¸ê®Æ¥þ³¡½Æ»s¨ì¤u§@ªí¤W?
¦pªG¤£¦æ,¥i§_ª½±µ§ì¨úºô¶¤W¾ãÓªí®æ¸ê®Æ?¦Ó¤£¥Î°j°é¤@Ó¤@ӶפJ,·|«ÜºC
2.ºô¸ô¤W¦³¬d¸ß¨ì¥i¥H¤£¥Î¶}±Òºô¶,´N¯àI´º¹B¦æ§ì¸ê®Æªº¤è¦¡,¤£ª¾¹D¬O§_¯à¦¨¥\?
¥Ñ©ó¥vµÜ©iselenium§ïª©¦Ü¤µ,¦n¹³¼gªk¤]¦³ÅܤÆ
ºô¸ô¤W³\¦hªº¶}±Ò¤è¦¡¤w¸gµLªk¥¿±`¹B¦æ
¤p§Ìn§ìªºÀɮ׬O¤½¥q¤º³¡ªºchromeºô¶,©Ò¥H±o¾a³oÓ¤èªk
½d¨Ò¨Ï¥Îyahoo¤ôªdªÑ²¼ªº¸ê®Æ¨Ó´ú¸Õ
¦³ªº¹q¸£¥i¯à·|§ì¤£¨ì¸ê®Æ
«Øij¦b¥d¦íªº¦a¤è¥[¤Wdrive.waite 3000 '3000´N¬O¤T¬í
¹ê»Ú¤W§Ú·|¥Î¤¸¯À¥Í¦¨§@¬°¥[¸ü§¹¦¨ªº§PÂ_,¥H§Kºô¶©|¥¼¥[¸ü§¹¦¨´N¦b½Æ»s- Dim driver As Selenium.ChromeDriver
- Sub yahoo()
- Application.ScreenUpdating = False '°±¤î¿Ã¹õ§ó·s
- Application.DisplayAlerts = False '°õ¦æ§R°£«e¥ý¼È®É°±¤îĵ§i°T®§¡A°õ¦æ§¹¶·«ì´_ĵ§i°T®§¡C
- On Error Resume Next
- Sheets("¤ëªí¤U¸ü°Ï").Select
- Sheets("¤ëªí¤U¸ü°Ï").Range("A:P").Select
- Selection.ClearContents
- Set driver = CreateObject("Selenium.ChromeDriver") '±Ò°Êselenium
- URL = "https://tw.stock.yahoo.com/s/list.php?c=%A4%F4%AAd&rr=0.76405700%201556514294"
- driver.Get URL
- driver.Wait 1000
- SendKeys "^{a}" '¥þ¿ï
- driver.Wait 500
- SendKeys "^{c}" 'copy
- driver.Wait 1000
- Sheets("¤ëªí¤U¸ü°Ï").Select
- Sheets("¤ëªí¤U¸ü°Ï").Range("a1").Select
- ActiveSheet.PasteSpecial Format:="HTML", link:=False, DisplayAsIcon:=False, NoHTMLFormatting:=True '¥Î¯Â®æ¦¡¶K¤W
- driver.Wait 1000
- driver.Quit 'µ²§ôselenium
- Application.DisplayAlerts = True '°õ¦æ§R°£«e¥ý¼È®É°±¤îĵ§i°T®§¡A°õ¦æ§¹¶·«ì´_ĵ§i°T®§¡C
- Application.ScreenUpdating = True
- End Sub
½Æ»s¥N½X |
|
|
|
|
|
|
- ©«¤l
- 354
- ¥DÃD
- 5
- ºëµØ
- 0
- ¿n¤À
- 387
- ÂI¦W
- 0
- §@·~¨t²Î
- windows7
- ³nÅ骩¥»
- vba,vb,excel2007
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2017-1-8
- ³Ì«áµn¿ý
- 2024-8-2
|
https://stackoverflow.com/questions/38613307/using-selenium-vba-bringing-the-cell-values-from-a-dynamic-web-page-table-to-exc
¦pªG¥u¬O³æ¤@¤¸¯À©ÎªÌ³æ¤@Ȫº³¡¤À§Ú¯à°÷³B²z
¦ý¬O·í¸ê®Æ¬°ªí®æª¬ªp®É,¸ê®Æ¶q¤Ó¦h,¤@Ó¤@Ó³B²z©ÎªÌ¥h§ì¦³ÂI¤Ó²Ö
§Ú¥i¥H¥ý¥þ³¡¥á¨ìexcel¤º§Ú¦bºCºC³B²z,¤]¤ñ¸û¦n¼g...
¤j³¡¤À³£¥ÎÃþ¦ü³oºØªºÂù°j°é§ìªí®æ
¥u¬O¦³ÂIºC...
·Q»¡§Q¥Î°Å¶K諸¤è¦¡ª½±µ¥þ³¡¶K¤W
¦]¬°§Ú¦³ªºªí®æ´X¸U¦C....
For Each posts In driver.FindElementsByXPath("//table[contains(@class,'daen-report')]")
For Each post In posts.FindElementsByXPath(".//tr")
For Each t_data In post.FindElementsByXPath(".//td[@class='row-odd']|.//td")
y = y + 1
Cells(x, y) = t_data.Text
Next t_data
x = x + 1
y = 0
Next post
Next posts
¦Ó§Úì¥ý¥Îªº´N¬OÃþ¦ü³oºØªº
https://stackoverflow.com/questions/23992826/vba-ctrla-to-select-all-content-in-a-page-by-selenium-webdriver
¦ý¦]¬°¦bµ{¦¡°õ¦æ¤¤
¦pªGÂIÀ»¤FÂsÄý¾¹©ÎªÌ¥ô¦óÀɮ׸ê®Æ§¨
ºô¶¸òexcelªº±Ò¥Îª¬ºA·|®ø¥¢
·|¾ÉPÁä½L¾Þ±±¥h½Æ»s¨ì¿ù»~ªº¦a¤è
¹³excel vba¥»¨¦n¹³¦³
ie.ExecWB 17,1'// SelectAll
ie.ExecWB 12,2'//½Æ»s¿ï¾Ü
ªº¤è¦¡....
Ãö©ó«á»O¶}±Ò
https://stackoverflow.com/questions/16180428/can-selenium-webdriver-open-browser-windows-silently-in-background
https://stackoverflow.com/questions/48597592/how-to-make-selenium-chromedriver-run-headlessly-in-vba
https://stackoverflow.com/questions/42801833/how-to-run-chrome-driver-in-headless-mode-or-in-background
https://stackoverflow.com/questions/44028584/run-selenium-without-wrapper-installed |
|
|
|
|
|
|
- ©«¤l
- 361
- ¥DÃD
- 57
- ºëµØ
- 0
- ¿n¤À
- 426
- ÂI¦W
- 0
- §@·~¨t²Î
- win7
- ³nÅ骩¥»
- 2003,2010
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2010-5-13
- ³Ì«áµn¿ý
- 2022-12-8
|
¥»©«³Ì«á¥Ñ joey0415 ©ó 2019-4-30 18:44 ½s¿è
https://www.udemy.com/complete-web-automation-with-excel-vba/
³o½Òµ{¥un360¤¸
§A¦Ò¼{¤@¤U
§Ú¦Û¤v¦³¶R
À³¸Ó¬O§Anªºµª®×
¦pªG§An§Ö¤@ÂI
°ò¥»¤W¥u¯à¥Îxmlhttp¤è¦¡¤~¯à¸Ñ¨M
|
|
|
|
|
|
|