ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[¤À¨É] Âà´«ieª«¥ó»yªk¬°Selenium(chrome) ?

¥»©«³Ì«á¥Ñ singo1232001 ©ó 2022-10-19 10:54 ½s¿è

¦^´_ 30# t8899

Sub test()
Set DRIVER = CreateObject("Selenium.ChromeDriver")
DRIVER.Get "https://tw.stock.yahoo.com/quote/1101.TW"
Cells.ClearContents
Set ID0 = DRIVER.FindElementByID("qsp-overview-realtime-info")
Set UL1 = ID0.FindElementsBytag("ul")(1)

sp = Split(UL1.Text, Chr(10))
Cells(1, 1).Resize(UBound(sp), 1) = Application.Transpose(sp)
End Sub

¸É¥R ¤W¤Uº¦¶^ªº¤T¨¤§Î ¸ò­t¸¹ ¤W­z¨Ã¨S¦³°µ¯S§O³B²z
­Y¦³»Ý­n´N¥²¶·§Q¥Îtag³æ¿W§ä¥X¨Ó,¨Ì·Ó¤W¤T¨¤§Î »P ¤U¤T¨¤§Î ­Ó§O¤ñ¹ï­×§ï¥¿­t¼Æ

TOP

¦^´_ 31# singo1232001


§ó¥¿¤@¤U(³æ¦C ¸ò Âù¦C)

Sub test()
Set DRIVER = CreateObject("Selenium.ChromeDriver")
DRIVER.Get "https://tw.stock.yahoo.com/quote/1101.TW"
Cells.ClearContents
Set ID0 = DRIVER.FindElementByID("qsp-overview-realtime-info")
Set UL1 = ID0.FindElementsBytag("ul")(1)
'³æ¦C
sp = Split(UL1.Text, Chr(10))
Cells(1, 1).Resize(UBound(sp) + 1, 1) = Application.Transpose(sp)

'Âù¦C
u2 = UBound(sp) / 2
ReDim ar(1 To u2, 1 To 2)
For i = 0 To UBound(sp) Step 2
w = w + 1
ar(w, 1) = sp(i)
ar(w, 2) = sp(i + 1)
Next
Cells(1, 3).Resize(UBound(ar), 2) = ar
End Sub

TOP

¥»©«³Ì«á¥Ñ singo1232001 ©ó 2022-10-19 11:55 ½s¿è

¦^´_ 32# singo1232001


¥t¥~µ¹¤@¨Ç¨S¦w¸Ë¹Lseleniumªº³sµ²
http://forum.twbts.com/thread-23709-1-3.html

ª¦ÂΧì¤Wº¦¶^¤U¤T¨¤§Î.zip (15.57 KB)

TOP

        ÀR«ä¦Û¦b : ¤H¥Í¨S¦³©Ò¦³Åv¡A¥u¦³¥Í©Rªº¨Ï¥ÎÅv¡C
ªð¦^¦Cªí ¤W¤@¥DÃD