posting_duo 0.0.61 → 0.0.65
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/posting_duo.rb +417 -488
- metadata +2 -2
data/lib/posting_duo.rb
CHANGED
@@ -390,7 +390,7 @@ sleep(2)
|
|
390
390
|
# Alert 처리 부분
|
391
391
|
begin
|
392
392
|
wait = Selenium::WebDriver::Wait.new(:timeout => 3) # 3초 대기
|
393
|
-
alert = wait.until { driver.switch_to.alert } # alert가 나타날 때까지 기다림
|
393
|
+
alert = wait.until { @driver.switch_to.alert } # alert가 나타날 때까지 기다림
|
394
394
|
alert.accept # 알림을 확인
|
395
395
|
rescue
|
396
396
|
# 알림이 나타나지 않으면 예외 처리하고 넘어감
|
@@ -1486,29 +1486,20 @@ begin
|
|
1486
1486
|
@driver.switch_to.default_content()
|
1487
1487
|
#@driver.find_element(:xpath, '//*[@id="mb_kcaptcha"]')
|
1488
1488
|
el = @driver.find_element(:xpath, '//*[@id="mb_kcaptcha"]')
|
1489
|
-
@driver.action.move_to(el).perform
|
1490
1489
|
puts '-[√] 캡챠 발견!! 캡차 해제를 위한 환경설정 약 10초 소요.......'.red
|
1491
1490
|
puts '-[√] 챕챠 해제 중~ 해제 완료까지 마우스 움직이지 마세요.......'.red
|
1492
1491
|
puts '-[√] 챕챠 코드 code 1.......'.red
|
1493
1492
|
sleep(1)
|
1493
|
+
@driver.execute_script("arguments[0].scrollIntoView({behavior: 'smooth', block: 'center', inline: 'center'});", el) # 화면 가운데
|
1494
|
+
sleep(1)
|
1494
1495
|
mouse_move_percentage(0.3,0.02)
|
1495
1496
|
sleep(0.5)
|
1496
|
-
left_click
|
1497
|
-
sleep(1)
|
1498
|
-
@driver.find_element(:xpath, '//*[@id="mb_kcaptcha"]').click
|
1497
|
+
left_click
|
1499
1498
|
sleep(1)
|
1500
|
-
|
1501
|
-
|
1502
|
-
#@driver.manage.window.maximize
|
1503
|
-
|
1504
|
-
|
1505
|
-
el1 = @driver.find_element(:xpath, '//*[@id="mb_kcaptcha"]')
|
1506
|
-
@driver.action.context_click(el1).perform
|
1499
|
+
@driver.switch_to.window(@driver.window_handle) #핸들 주입
|
1500
|
+
@driver.action.context_click(el).perform #우 클릭
|
1507
1501
|
sleep(1)
|
1508
|
-
@driver.action.key_down(:shift).key_stroke('m').key_up(:shift).perform
|
1509
|
-
#key_down('shift')
|
1510
|
-
#key_stroke('m')
|
1511
|
-
#key_up('shift')
|
1502
|
+
@driver.action.key_down(:shift).key_stroke('m').key_up(:shift).perform #단축키
|
1512
1503
|
sleep(1)
|
1513
1504
|
puts '-[√] 캡챠 코드 타겟 완료1.......'.blue
|
1514
1505
|
rescue
|
@@ -1516,29 +1507,20 @@ rescue
|
|
1516
1507
|
@driver.switch_to.default_content()
|
1517
1508
|
#@driver.find_element(:xpath, '//*[@alt="자동등록방지"]')
|
1518
1509
|
el = @driver.find_element(:xpath, '//*[@alt="자동등록방지"]')
|
1519
|
-
@driver.action.move_to(el).perform
|
1520
1510
|
puts '-[√] 캡챠 발견!! 캡차 해제를 위한 환경설정 약 10초 소요.......'.red
|
1521
1511
|
puts '-[√] 챕챠 해제 중~ 해제 완료까지 마우스 움직이지 마세요.......'.red
|
1522
1512
|
puts '-[√] 챕챠 코드 code 2.......'.red
|
1523
1513
|
sleep(1)
|
1514
|
+
@driver.execute_script("arguments[0].scrollIntoView({behavior: 'smooth', block: 'center', inline: 'center'});", el) # 화면 가운데
|
1515
|
+
sleep(1)
|
1524
1516
|
mouse_move_percentage(0.3,0.02)
|
1525
1517
|
sleep(0.5)
|
1526
|
-
left_click
|
1527
|
-
sleep(1)
|
1528
|
-
@driver.find_element(:xpath, '//*[@alt="자동등록방지"]').click
|
1518
|
+
left_click
|
1529
1519
|
sleep(1)
|
1530
|
-
|
1531
|
-
|
1532
|
-
#@driver.manage.window.maximize
|
1533
|
-
|
1534
|
-
|
1535
|
-
el1 = @driver.find_element(:xpath, '//*[@alt="자동등록방지"]')
|
1536
|
-
@driver.action.context_click(el1).perform
|
1520
|
+
@driver.switch_to.window(@driver.window_handle) #핸들 주입
|
1521
|
+
@driver.action.context_click(el).perform #우 클릭
|
1537
1522
|
sleep(1)
|
1538
|
-
@driver.action.key_down(:shift).key_stroke('m').key_up(:shift).perform
|
1539
|
-
#key_down('shift')
|
1540
|
-
#key_stroke('m')
|
1541
|
-
#key_up('shift')
|
1523
|
+
@driver.action.key_down(:shift).key_stroke('m').key_up(:shift).perform #단축키
|
1542
1524
|
sleep(1)
|
1543
1525
|
puts '-[√] 캡챠 코드 타겟 완료1.......'.blue
|
1544
1526
|
rescue
|
@@ -1547,35 +1529,26 @@ rescue
|
|
1547
1529
|
sleep(1)
|
1548
1530
|
#@driver.find_element(:xpath, '//*[@id="captcha_img"]').send_keys(:tab)
|
1549
1531
|
el = @driver.find_element(:xpath, '//*[@id="captcha_img"]')
|
1550
|
-
@driver.action.move_to(el).perform
|
1551
1532
|
puts '-[√] 캡챠 발견!! 캡차 해제를 위한 환경설정 약 10초 소요.......'.red
|
1552
1533
|
puts '-[√] 챕챠 해제 중~ 해제 완료까지 마우스 움직이지 마세요.......'.red
|
1553
1534
|
puts '-[√] 챕챠 코드 code 3.......'.red
|
1554
1535
|
sleep(1)
|
1555
|
-
begin
|
1556
1536
|
#요소 자체 제거 하기 기능
|
1557
1537
|
chat_box = @driver.find_element(:xpath, '//*[@for="captcha_key"]')
|
1558
1538
|
@driver.execute_script("arguments[0].remove();", chat_box)
|
1559
1539
|
sleep(1)
|
1560
|
-
|
1561
|
-
|
1540
|
+
|
1541
|
+
sleep(1)
|
1542
|
+
@driver.execute_script("arguments[0].scrollIntoView({behavior: 'smooth', block: 'center', inline: 'center'});", el) # 화면 가운데
|
1543
|
+
sleep(1)
|
1562
1544
|
mouse_move_percentage(0.3,0.02)
|
1563
1545
|
sleep(0.5)
|
1564
|
-
left_click
|
1546
|
+
left_click
|
1565
1547
|
sleep(1)
|
1566
|
-
@driver.
|
1548
|
+
@driver.switch_to.window(@driver.window_handle) #핸들 주입
|
1549
|
+
@driver.action.context_click(el).perform #우 클릭
|
1567
1550
|
sleep(1)
|
1568
|
-
|
1569
|
-
|
1570
|
-
|
1571
|
-
|
1572
|
-
el1 = @driver.find_element(:xpath, '//*[@id="captcha_img"]')
|
1573
|
-
@driver.action.context_click(el1).perform
|
1574
|
-
sleep(1)
|
1575
|
-
@driver.action.key_down(:shift).key_stroke('m').key_up(:shift).perform #컨트롤+a
|
1576
|
-
#key_down('shift')
|
1577
|
-
#key_stroke('m')
|
1578
|
-
#key_up('shift')
|
1551
|
+
@driver.action.key_down(:shift).key_stroke('m').key_up(:shift).perform #단축키
|
1579
1552
|
sleep(1)
|
1580
1553
|
puts '-[√] 캡챠 코드 타겟 완료1.......'.blue
|
1581
1554
|
rescue
|
@@ -1583,281 +1556,226 @@ rescue
|
|
1583
1556
|
@driver.switch_to.default_content()
|
1584
1557
|
#@driver.find_element(:xpath, '//*[@id="kcaptcha"]')
|
1585
1558
|
el = @driver.find_element(:xpath, '//*[@id="kcaptcha"]')
|
1586
|
-
@driver.action.move_to(el).perform
|
1587
1559
|
puts '-[√] 캡챠 발견!! 캡차 해제를 위한 환경설정 약 10초 소요.......'.red
|
1588
1560
|
puts '-[√] 챕챠 해제 중~ 해제 완료까지 마우스 움직이지 마세요.......'.red
|
1589
1561
|
puts '-[√] 챕챠 코드 code 4.......'.red
|
1590
1562
|
sleep(1)
|
1563
|
+
@driver.execute_script("arguments[0].scrollIntoView({behavior: 'smooth', block: 'center', inline: 'center'});", el) # 화면 가운데
|
1564
|
+
sleep(1)
|
1591
1565
|
mouse_move_percentage(0.3,0.02)
|
1592
1566
|
sleep(0.5)
|
1593
|
-
left_click
|
1594
|
-
sleep(1)
|
1595
|
-
@driver.find_element(:xpath, '//*[@id="kcaptcha"]').click
|
1567
|
+
left_click
|
1596
1568
|
sleep(1)
|
1597
|
-
|
1598
|
-
|
1599
|
-
#@driver.manage.window.maximize
|
1600
|
-
|
1601
|
-
|
1602
|
-
el1 = @driver.find_element(:xpath, '//*[@id="kcaptcha"]')
|
1603
|
-
@driver.action.context_click(el1).perform
|
1569
|
+
@driver.switch_to.window(@driver.window_handle) #핸들 주입
|
1570
|
+
@driver.action.context_click(el).perform #우 클릭
|
1604
1571
|
sleep(1)
|
1605
|
-
@driver.action.key_down(:shift).key_stroke('m').key_up(:shift).perform
|
1606
|
-
#key_down('shift')
|
1607
|
-
#key_stroke('m')
|
1608
|
-
#key_up('shift')
|
1572
|
+
@driver.action.key_down(:shift).key_stroke('m').key_up(:shift).perform #단축키
|
1609
1573
|
sleep(1)
|
1610
1574
|
puts '-[√] 캡챠 코드 타겟 완료1.......'.blue
|
1611
1575
|
rescue
|
1612
1576
|
begin
|
1613
1577
|
@driver.switch_to.default_content()
|
1614
|
-
|
1615
|
-
|
1616
|
-
|
1578
|
+
@driver.find_elements(:tag_name, 'img').each do |img|
|
1579
|
+
if img.attribute('src').include?('kboard_captcha')
|
1580
|
+
el = img # 캡챠 이미지를 el에 저장
|
1581
|
+
break # 첫 번째 이미지를 찾으면 루프 종료
|
1582
|
+
end
|
1583
|
+
end
|
1617
1584
|
puts '-[√] 캡챠 발견!! 캡차 해제를 위한 환경설정 약 10초 소요.......'.red
|
1618
1585
|
puts '-[√] 챕챠 해제 중~ 해제 완료까지 마우스 움직이지 마세요.......'.red
|
1619
|
-
puts '-[√] 챕챠 코드 code 5.......'.red
|
1586
|
+
puts '-[√] 챕챠 코드 code 5-1.......'.red
|
1587
|
+
sleep(1)
|
1588
|
+
@driver.execute_script("arguments[0].scrollIntoView({behavior: 'smooth', block: 'center', inline: 'center'});", el) # 화면 가운데
|
1620
1589
|
sleep(1)
|
1621
1590
|
mouse_move_percentage(0.3,0.02)
|
1622
1591
|
sleep(0.5)
|
1623
|
-
left_click
|
1592
|
+
left_click
|
1624
1593
|
sleep(1)
|
1625
|
-
@driver.
|
1594
|
+
@driver.switch_to.window(@driver.window_handle) #핸들 주입
|
1595
|
+
@driver.action.context_click(el).perform #우 클릭
|
1626
1596
|
sleep(1)
|
1627
|
-
|
1628
|
-
#sleep(2)
|
1629
|
-
#@driver.manage.window.maximize
|
1630
|
-
|
1631
|
-
el1 = @driver.find_element(:xpath, '//*[@for="kboard-input-captcha"]')
|
1632
|
-
@driver.action.context_click(el1).perform
|
1633
|
-
sleep(1)
|
1634
|
-
@driver.action.key_down(:shift).key_stroke('m').key_up(:shift).perform #컨트롤+a
|
1635
|
-
#key_down('shift')
|
1636
|
-
#key_stroke('m')
|
1637
|
-
#key_up('shift')
|
1597
|
+
@driver.action.key_down(:shift).key_stroke('m').key_up(:shift).perform #단축키
|
1638
1598
|
sleep(1)
|
1639
1599
|
puts '-[√] 캡챠 코드 타겟 완료1.......'.blue
|
1640
1600
|
rescue
|
1641
1601
|
begin
|
1642
1602
|
@driver.switch_to.default_content()
|
1643
|
-
|
1644
|
-
|
1645
|
-
el = @driver.find_element(:xpath, '//*[@id="captcha_Write"]')
|
1646
|
-
@driver.action.move_to(el).perform
|
1603
|
+
#@driver.find_element(:xpath, '//*[@for="kboard-input-captcha"]')
|
1604
|
+
el = @driver.find_element(:css, 'label[for="kboard-input-captcha"] img')
|
1647
1605
|
puts '-[√] 캡챠 발견!! 캡차 해제를 위한 환경설정 약 10초 소요.......'.red
|
1648
1606
|
puts '-[√] 챕챠 해제 중~ 해제 완료까지 마우스 움직이지 마세요.......'.red
|
1649
|
-
puts '-[√] 챕챠 코드 code
|
1607
|
+
puts '-[√] 챕챠 코드 code 5-2.......'.red
|
1608
|
+
sleep(1)
|
1609
|
+
@driver.execute_script("arguments[0].scrollIntoView({behavior: 'smooth', block: 'center', inline: 'center'});", el) # 화면 가운데
|
1650
1610
|
sleep(1)
|
1651
1611
|
mouse_move_percentage(0.3,0.02)
|
1652
1612
|
sleep(0.5)
|
1653
|
-
left_click
|
1654
|
-
sleep(1)
|
1655
|
-
@driver.find_element(:xpath, '//*[@id="captcha_Write"]').click
|
1613
|
+
left_click
|
1656
1614
|
sleep(1)
|
1657
|
-
|
1658
|
-
|
1659
|
-
#@driver.manage.window.maximize
|
1660
|
-
|
1661
|
-
|
1662
|
-
el1 = @driver.find_element(:xpath, '//*[@id="captcha_Write"]')
|
1663
|
-
@driver.action.context_click(el1).perform
|
1615
|
+
@driver.switch_to.window(@driver.window_handle) #핸들 주입
|
1616
|
+
@driver.action.context_click(el).perform #우 클릭
|
1664
1617
|
sleep(1)
|
1665
|
-
@driver.action.key_down(:shift).key_stroke('m').key_up(:shift).perform
|
1666
|
-
#key_down('shift')
|
1667
|
-
#key_stroke('m')
|
1668
|
-
#key_up('shift')
|
1618
|
+
@driver.action.key_down(:shift).key_stroke('m').key_up(:shift).perform #단축키
|
1669
1619
|
sleep(1)
|
1670
1620
|
puts '-[√] 캡챠 코드 타겟 완료1.......'.blue
|
1671
1621
|
rescue
|
1672
1622
|
begin
|
1673
1623
|
@driver.switch_to.default_content()
|
1674
|
-
|
1675
|
-
|
1676
|
-
@driver.
|
1624
|
+
sleep(1)
|
1625
|
+
#@driver.find_element(:xpath, '//*[@id="captcha_Write"]')
|
1626
|
+
el = @driver.find_element(:xpath, '//*[@id="captcha_Write"]')
|
1677
1627
|
puts '-[√] 캡챠 발견!! 캡차 해제를 위한 환경설정 약 10초 소요.......'.red
|
1678
1628
|
puts '-[√] 챕챠 해제 중~ 해제 완료까지 마우스 움직이지 마세요.......'.red
|
1679
|
-
puts '-[√] 챕챠 코드 code
|
1629
|
+
puts '-[√] 챕챠 코드 code 6.......'.red
|
1630
|
+
sleep(1)
|
1631
|
+
@driver.execute_script("arguments[0].scrollIntoView({behavior: 'smooth', block: 'center', inline: 'center'});", el) # 화면 가운데
|
1680
1632
|
sleep(1)
|
1681
1633
|
mouse_move_percentage(0.3,0.02)
|
1682
1634
|
sleep(0.5)
|
1683
|
-
left_click
|
1635
|
+
left_click
|
1684
1636
|
sleep(1)
|
1685
|
-
@driver.
|
1637
|
+
@driver.switch_to.window(@driver.window_handle) #핸들 주입
|
1638
|
+
@driver.action.context_click(el).perform #우 클릭
|
1686
1639
|
sleep(1)
|
1687
|
-
|
1688
|
-
#sleep(2)
|
1689
|
-
#@driver.manage.window.maximize
|
1690
|
-
|
1691
|
-
|
1692
|
-
el1 = @driver.find_element(:xpath, '//*[@image-reader="in-progress"]')
|
1693
|
-
@driver.action.context_click(el1).perform
|
1694
|
-
sleep(1)
|
1695
|
-
@driver.action.key_down(:shift).key_stroke('m').key_up(:shift).perform #컨트롤+a
|
1696
|
-
#key_down('shift')
|
1697
|
-
#key_stroke('m')
|
1698
|
-
#key_up('shift')
|
1640
|
+
@driver.action.key_down(:shift).key_stroke('m').key_up(:shift).perform #단축키
|
1699
1641
|
sleep(1)
|
1700
1642
|
puts '-[√] 캡챠 코드 타겟 완료1.......'.blue
|
1701
1643
|
rescue
|
1702
1644
|
begin
|
1703
1645
|
@driver.switch_to.default_content()
|
1704
|
-
#@driver.find_element(:xpath, '//*[@
|
1705
|
-
el = @driver.find_element(:xpath, '//*[@
|
1706
|
-
@driver.action.move_to(el).perform
|
1646
|
+
#@driver.find_element(:xpath, '//*[@image-reader="in-progress"]')
|
1647
|
+
el = @driver.find_element(:xpath, '//*[@image-reader="in-progress"]')
|
1707
1648
|
puts '-[√] 캡챠 발견!! 캡차 해제를 위한 환경설정 약 10초 소요.......'.red
|
1708
1649
|
puts '-[√] 챕챠 해제 중~ 해제 완료까지 마우스 움직이지 마세요.......'.red
|
1709
|
-
puts '-[√] 챕챠 코드 code
|
1650
|
+
puts '-[√] 챕챠 코드 code 7.......'.red
|
1651
|
+
sleep(1)
|
1652
|
+
@driver.execute_script("arguments[0].scrollIntoView({behavior: 'smooth', block: 'center', inline: 'center'});", el) # 화면 가운데
|
1710
1653
|
sleep(1)
|
1711
1654
|
mouse_move_percentage(0.3,0.02)
|
1712
1655
|
sleep(0.5)
|
1713
|
-
left_click
|
1656
|
+
left_click
|
1714
1657
|
sleep(1)
|
1715
|
-
@driver.
|
1658
|
+
@driver.switch_to.window(@driver.window_handle) #핸들 주입
|
1659
|
+
@driver.action.context_click(el).perform #우 클릭
|
1716
1660
|
sleep(1)
|
1717
|
-
|
1718
|
-
#sleep(2)
|
1719
|
-
#@driver.manage.window.maximize
|
1720
|
-
|
1721
|
-
|
1722
|
-
el1 = @driver.find_element(:xpath, '//*[@id="spamauth"]')
|
1723
|
-
@driver.action.context_click(el1).perform
|
1724
|
-
sleep(1)
|
1725
|
-
@driver.action.key_down(:shift).key_stroke('m').key_up(:shift).perform #컨트롤+a
|
1726
|
-
#key_down('shift')
|
1727
|
-
#key_stroke('m')
|
1728
|
-
#key_up('shift')
|
1661
|
+
@driver.action.key_down(:shift).key_stroke('m').key_up(:shift).perform #단축키
|
1729
1662
|
sleep(1)
|
1730
1663
|
puts '-[√] 캡챠 코드 타겟 완료1.......'.blue
|
1731
1664
|
rescue
|
1732
1665
|
begin
|
1733
1666
|
@driver.switch_to.default_content()
|
1734
|
-
#@driver.find_element(:xpath, '//*[@id="
|
1735
|
-
el = @driver.find_element(:xpath, '//*[@id="
|
1736
|
-
@driver.action.move_to(el).perform
|
1667
|
+
#@driver.find_element(:xpath, '//*[@id="spamauth"]')
|
1668
|
+
el = @driver.find_element(:xpath, '//*[@id="spamauth"]')
|
1737
1669
|
puts '-[√] 캡챠 발견!! 캡차 해제를 위한 환경설정 약 10초 소요.......'.red
|
1738
1670
|
puts '-[√] 챕챠 해제 중~ 해제 완료까지 마우스 움직이지 마세요.......'.red
|
1739
|
-
puts '-[√] 챕챠 코드 code
|
1671
|
+
puts '-[√] 챕챠 코드 code 8.......'.red
|
1672
|
+
sleep(1)
|
1673
|
+
@driver.execute_script("arguments[0].scrollIntoView({behavior: 'smooth', block: 'center', inline: 'center'});", el) # 화면 가운데
|
1740
1674
|
sleep(1)
|
1741
1675
|
mouse_move_percentage(0.3,0.02)
|
1742
1676
|
sleep(0.5)
|
1743
|
-
left_click
|
1677
|
+
left_click
|
1744
1678
|
sleep(1)
|
1745
|
-
@driver.
|
1679
|
+
@driver.switch_to.window(@driver.window_handle) #핸들 주입
|
1680
|
+
@driver.action.context_click(el).perform #우 클릭
|
1746
1681
|
sleep(1)
|
1747
|
-
|
1748
|
-
#sleep(2)
|
1749
|
-
#@driver.manage.window.maximize
|
1750
|
-
|
1751
|
-
|
1752
|
-
el1 = @driver.find_element(:xpath, '//*[@id="norobot_img"]')
|
1753
|
-
@driver.action.context_click(el1).perform
|
1754
|
-
sleep(1)
|
1755
|
-
@driver.action.key_down(:shift).key_stroke('m').key_up(:shift).perform #컨트롤+a
|
1756
|
-
#key_down('shift')
|
1757
|
-
#key_stroke('m')
|
1758
|
-
#key_up('shift')
|
1682
|
+
@driver.action.key_down(:shift).key_stroke('m').key_up(:shift).perform #단축키
|
1759
1683
|
sleep(1)
|
1760
1684
|
puts '-[√] 캡챠 코드 타겟 완료1.......'.blue
|
1761
1685
|
rescue
|
1762
1686
|
begin
|
1763
1687
|
@driver.switch_to.default_content()
|
1764
|
-
#@driver.find_element(:xpath, '//*[@
|
1765
|
-
el = @driver.find_element(:xpath, '//*[@
|
1766
|
-
@driver.action.move_to(el).perform
|
1688
|
+
#@driver.find_element(:xpath, '//*[@id="norobot_img"]')
|
1689
|
+
el = @driver.find_element(:xpath, '//*[@id="norobot_img"]')
|
1767
1690
|
puts '-[√] 캡챠 발견!! 캡차 해제를 위한 환경설정 약 10초 소요.......'.red
|
1768
1691
|
puts '-[√] 챕챠 해제 중~ 해제 완료까지 마우스 움직이지 마세요.......'.red
|
1769
|
-
puts '-[√] 챕챠 코드 code
|
1692
|
+
puts '-[√] 챕챠 코드 code 9.......'.red
|
1693
|
+
sleep(1)
|
1694
|
+
@driver.execute_script("arguments[0].scrollIntoView({behavior: 'smooth', block: 'center', inline: 'center'});", el) # 화면 가운데
|
1770
1695
|
sleep(1)
|
1771
1696
|
mouse_move_percentage(0.3,0.02)
|
1772
1697
|
sleep(0.5)
|
1773
|
-
left_click
|
1698
|
+
left_click
|
1774
1699
|
sleep(1)
|
1775
|
-
@driver.
|
1700
|
+
@driver.switch_to.window(@driver.window_handle) #핸들 주입
|
1701
|
+
@driver.action.context_click(el).perform #우 클릭
|
1776
1702
|
sleep(1)
|
1777
|
-
|
1778
|
-
#sleep(2)
|
1779
|
-
#@driver.manage.window.maximize
|
1780
|
-
|
1781
|
-
|
1782
|
-
el1 = @driver.find_element(:xpath, '//*[@class="CodeImage"]')
|
1783
|
-
@driver.action.context_click(el1).perform
|
1784
|
-
sleep(1)
|
1785
|
-
@driver.action.key_down(:shift).key_stroke('m').key_up(:shift).perform #컨트롤+a
|
1786
|
-
#key_down('shift')
|
1787
|
-
#key_stroke('m')
|
1788
|
-
#key_up('shift')
|
1703
|
+
@driver.action.key_down(:shift).key_stroke('m').key_up(:shift).perform #단축키
|
1789
1704
|
sleep(1)
|
1790
1705
|
puts '-[√] 캡챠 코드 타겟 완료1.......'.blue
|
1791
1706
|
rescue
|
1792
1707
|
begin
|
1793
1708
|
@driver.switch_to.default_content()
|
1794
|
-
|
1795
|
-
el = @driver.find_element(:xpath, '//*[@id="kcaptcha_image"]')
|
1796
|
-
@driver.action.move_to(el).perform
|
1709
|
+
el = @driver.find_element(:xpath, '//*[@class="CodeImage"]')
|
1797
1710
|
puts '-[√] 캡챠 발견!! 캡차 해제를 위한 환경설정 약 10초 소요.......'.red
|
1798
1711
|
puts '-[√] 챕챠 해제 중~ 해제 완료까지 마우스 움직이지 마세요.......'.red
|
1799
|
-
puts '-[√] 챕챠 코드 code
|
1712
|
+
puts '-[√] 챕챠 코드 code 10.......'.red
|
1713
|
+
sleep(1)
|
1714
|
+
@driver.execute_script("arguments[0].scrollIntoView({behavior: 'smooth', block: 'center', inline: 'center'});", el) # 화면 가운데
|
1800
1715
|
sleep(1)
|
1801
1716
|
mouse_move_percentage(0.3,0.02)
|
1802
1717
|
sleep(0.5)
|
1803
|
-
left_click
|
1718
|
+
left_click
|
1804
1719
|
sleep(1)
|
1805
|
-
@driver.
|
1720
|
+
@driver.switch_to.window(@driver.window_handle) #핸들 주입
|
1721
|
+
@driver.action.context_click(el).perform #우 클릭
|
1806
1722
|
sleep(1)
|
1807
|
-
|
1808
|
-
#sleep(2)
|
1809
|
-
#@driver.manage.window.maximize
|
1810
|
-
|
1811
|
-
|
1812
|
-
el1 = @driver.find_element(:xpath, '//*[@id="kcaptcha_image"]')
|
1813
|
-
@driver.action.context_click(el1).perform
|
1814
|
-
sleep(1)
|
1815
|
-
@driver.action.key_down(:shift).key_stroke('m').key_up(:shift).perform #컨트롤+a
|
1816
|
-
#key_down('shift')
|
1817
|
-
#key_stroke('m')
|
1818
|
-
#key_up('shift')
|
1723
|
+
@driver.action.key_down(:shift).key_stroke('m').key_up(:shift).perform #단축키
|
1819
1724
|
sleep(1)
|
1820
1725
|
puts '-[√] 캡챠 코드 타겟 완료1.......'.blue
|
1821
1726
|
rescue
|
1822
1727
|
begin
|
1823
1728
|
@driver.switch_to.default_content()
|
1824
|
-
|
1825
|
-
el = @driver.find_element(:xpath, '//*[@class="lazy-loaded"]')
|
1826
|
-
@driver.action.move_to(el).perform
|
1729
|
+
el = @driver.find_element(:xpath, '//*[@id="kcaptcha_image"]')
|
1827
1730
|
puts '-[√] 캡챠 발견!! 캡차 해제를 위한 환경설정 약 10초 소요.......'.red
|
1828
1731
|
puts '-[√] 챕챠 해제 중~ 해제 완료까지 마우스 움직이지 마세요.......'.red
|
1829
1732
|
puts '-[√] 챕챠 코드 code 11.......'.red
|
1830
1733
|
sleep(1)
|
1734
|
+
@driver.execute_script("arguments[0].scrollIntoView({behavior: 'smooth', block: 'center', inline: 'center'});", el) # 화면 가운데
|
1735
|
+
sleep(1)
|
1831
1736
|
mouse_move_percentage(0.3,0.02)
|
1832
1737
|
sleep(0.5)
|
1833
|
-
left_click
|
1738
|
+
left_click
|
1834
1739
|
sleep(1)
|
1835
|
-
@driver.
|
1836
|
-
|
1837
|
-
#@driver.manage.window.position = Selenium::WebDriver::Point.new(0, 0)
|
1838
|
-
#sleep(2)
|
1839
|
-
#@driver.manage.window.maximize
|
1840
|
-
|
1841
|
-
|
1842
|
-
el1 = @driver.find_element(:xpath, '//*[@class="lazy-loaded"]')
|
1843
|
-
@driver.action.context_click(el1).perform
|
1740
|
+
@driver.switch_to.window(@driver.window_handle) #핸들 주입
|
1741
|
+
@driver.action.context_click(el).perform #우 클릭
|
1844
1742
|
sleep(1)
|
1845
|
-
@driver.action.key_down(:shift).key_stroke('m').key_up(:shift).perform
|
1846
|
-
#key_down('shift')
|
1847
|
-
#key_stroke('m')
|
1848
|
-
#key_up('shift')
|
1743
|
+
@driver.action.key_down(:shift).key_stroke('m').key_up(:shift).perform #단축키
|
1849
1744
|
sleep(1)
|
1850
1745
|
puts '-[√] 캡챠 코드 타겟 완료1.......'.blue
|
1851
1746
|
rescue
|
1747
|
+
begin
|
1748
|
+
@driver.switch_to.default_content()
|
1749
|
+
el = @driver.find_element(:xpath, '//*[@class="lazy-loaded"]')
|
1750
|
+
puts '-[√] 캡챠 발견!! 캡차 해제를 위한 환경설정 약 10초 소요.......'.red
|
1751
|
+
puts '-[√] 챕챠 해제 중~ 해제 완료까지 마우스 움직이지 마세요.......'.red
|
1752
|
+
puts '-[√] 챕챠 코드 code 12.......'.red
|
1753
|
+
sleep(1)
|
1754
|
+
@driver.execute_script("arguments[0].scrollIntoView({behavior: 'smooth', block: 'center', inline: 'center'});", el) # 화면 가운데
|
1755
|
+
sleep(1)
|
1756
|
+
mouse_move_percentage(0.3,0.02)
|
1757
|
+
sleep(0.5)
|
1758
|
+
left_click
|
1759
|
+
sleep(1)
|
1760
|
+
@driver.switch_to.window(@driver.window_handle) #핸들 주입
|
1761
|
+
@driver.action.context_click(el).perform #우 클릭
|
1762
|
+
sleep(1)
|
1763
|
+
@driver.action.key_down(:shift).key_stroke('m').key_up(:shift).perform #단축키
|
1764
|
+
sleep(1)
|
1765
|
+
puts '-[√] 캡챠 코드 타겟 완료1.......'.blue
|
1766
|
+
rescue
|
1767
|
+
|
1768
|
+
end
|
1769
|
+
end
|
1852
1770
|
|
1853
|
-
|
1854
|
-
end
|
1771
|
+
end
|
1855
1772
|
end
|
1856
1773
|
end
|
1857
1774
|
end
|
1858
1775
|
end
|
1859
1776
|
end
|
1860
1777
|
end
|
1778
|
+
|
1861
1779
|
end
|
1862
1780
|
end
|
1863
1781
|
end
|
@@ -2050,23 +1968,22 @@ rescue
|
|
2050
1968
|
rescue
|
2051
1969
|
begin
|
2052
1970
|
@driver.find_element(:xpath, '//*[@name="captcha"]').click
|
2053
|
-
|
2054
1971
|
sleep(1)
|
2055
|
-
|
1972
|
+
|
1973
|
+
# CAPTCHA 요소 찾기
|
2056
1974
|
el2 = @driver.find_element(:xpath, '//*[@name="captcha"]')
|
1975
|
+
|
1976
|
+
# 우클릭 (context_click) 실행
|
2057
1977
|
@driver.action.context_click(el2).perform
|
2058
|
-
|
2059
1978
|
sleep(1)
|
2060
1979
|
@driver.action.key_stroke('up')
|
2061
1980
|
sleep(1)
|
2062
1981
|
@driver.action.key_stroke('up')
|
2063
1982
|
sleep(1)
|
2064
1983
|
@driver.action.key_stroke('enter')
|
2065
|
-
sleep(1)
|
2066
1984
|
begin
|
2067
|
-
# 요소 찾기 타임아웃을 7초로 설정
|
2068
1985
|
wait = Selenium::WebDriver::Wait.new(:timeout => 7)
|
2069
|
-
|
1986
|
+
# 요소가 나타날 때까지 7초 동안 기다립니다.
|
2070
1987
|
wait.until { @driver.find_element(:xpath, '//*[@class="captcha-solver captcha-solver_inner"]') }
|
2071
1988
|
rescue
|
2072
1989
|
sleep(1)
|
@@ -2345,46 +2262,7 @@ rescue
|
|
2345
2262
|
puts '-[√] 캡챠 코드 타겟 완료2.......'.blue
|
2346
2263
|
sleep(1)
|
2347
2264
|
rescue
|
2348
|
-
|
2349
|
-
@driver.switch_to.default_content()
|
2350
|
-
sleep(1)
|
2351
|
-
@driver.find_element(:xpath, '//*[@id="captcha_code"]').click
|
2352
|
-
|
2353
|
-
sleep(1)
|
2354
|
-
|
2355
|
-
el2 = @driver.find_element(:xpath, '//*[@id="captcha_code"]')
|
2356
|
-
@driver.action.context_click(el2).perform
|
2357
|
-
|
2358
|
-
sleep(1)
|
2359
|
-
@driver.action.key_stroke('up')
|
2360
|
-
sleep(1)
|
2361
|
-
@driver.action.key_stroke('up')
|
2362
|
-
sleep(1)
|
2363
|
-
@driver.action.key_stroke('enter')
|
2364
|
-
sleep(1)
|
2365
|
-
begin
|
2366
|
-
# 요소 찾기 타임아웃을 7초로 설정
|
2367
|
-
wait = Selenium::WebDriver::Wait.new(:timeout => 7)
|
2368
|
-
#요소가 나타날 때까지 7초 동안 기다립니다.
|
2369
|
-
wait.until { @driver.find_element(:xpath, '//*[@class="captcha-solver captcha-solver_inner"]') }
|
2370
|
-
rescue
|
2371
|
-
sleep(1)
|
2372
|
-
@driver.action.key_stroke('left')
|
2373
|
-
sleep(1)
|
2374
|
-
@driver.action.key_stroke('up')
|
2375
|
-
sleep(1)
|
2376
|
-
@driver.action.key_stroke('enter')
|
2377
|
-
sleep(1)
|
2378
|
-
# 요소 찾기 타임아웃을 7초로 설정
|
2379
|
-
wait = Selenium::WebDriver::Wait.new(:timeout => 7)
|
2380
|
-
#요소가 나타날 때까지 7초 동안 기다립니다.
|
2381
|
-
wait.until { @driver.find_element(:xpath, '//*[@class="captcha-solver captcha-solver_inner"]') }
|
2382
|
-
end
|
2383
|
-
puts '-[√] 캡챠 코드 타겟 완료2.......'.blue
|
2384
|
-
sleep(1)
|
2385
|
-
rescue
|
2386
|
-
|
2387
|
-
end
|
2265
|
+
|
2388
2266
|
end
|
2389
2267
|
end
|
2390
2268
|
end
|
@@ -2564,7 +2442,7 @@ end
|
|
2564
2442
|
# Alert 처리 부분
|
2565
2443
|
begin
|
2566
2444
|
wait = Selenium::WebDriver::Wait.new(:timeout => 3) # 3초 대기
|
2567
|
-
alert = wait.until { driver.switch_to.alert } # alert가 나타날 때까지 기다림
|
2445
|
+
alert = wait.until { @driver.switch_to.alert } # alert가 나타날 때까지 기다림
|
2568
2446
|
alert.accept # 알림을 확인
|
2569
2447
|
rescue
|
2570
2448
|
# 알림이 나타나지 않으면 예외 처리하고 넘어감
|
@@ -2597,7 +2475,7 @@ login_url = option['login_url'].to_s
|
|
2597
2475
|
# Alert 처리 부분
|
2598
2476
|
begin
|
2599
2477
|
wait = Selenium::WebDriver::Wait.new(:timeout => 3) # 3초 대기
|
2600
|
-
alert = wait.until { driver.switch_to.alert } # alert가 나타날 때까지 기다림
|
2478
|
+
alert = wait.until { @driver.switch_to.alert } # alert가 나타날 때까지 기다림
|
2601
2479
|
alert.accept # 알림을 확인
|
2602
2480
|
rescue
|
2603
2481
|
# 알림이 나타나지 않으면 예외 처리하고 넘어감
|
@@ -3763,7 +3641,7 @@ login_url = option['login_url'].to_s
|
|
3763
3641
|
# Alert 처리 부분
|
3764
3642
|
begin
|
3765
3643
|
wait = Selenium::WebDriver::Wait.new(:timeout => 3) # 3초 대기
|
3766
|
-
alert = wait.until { driver.switch_to.alert } # alert가 나타날 때까지 기다림
|
3644
|
+
alert = wait.until { @driver.switch_to.alert } # alert가 나타날 때까지 기다림
|
3767
3645
|
alert.accept # 알림을 확인
|
3768
3646
|
rescue
|
3769
3647
|
# 알림이 나타나지 않으면 예외 처리하고 넘어감
|
@@ -3802,7 +3680,7 @@ begin
|
|
3802
3680
|
# Alert 처리 부분
|
3803
3681
|
begin
|
3804
3682
|
wait = Selenium::WebDriver::Wait.new(:timeout => 3) # 3초 대기
|
3805
|
-
alert = wait.until { driver.switch_to.alert } # alert가 나타날 때까지 기다림
|
3683
|
+
alert = wait.until { @driver.switch_to.alert } # alert가 나타날 때까지 기다림
|
3806
3684
|
alert.accept # 알림을 확인
|
3807
3685
|
rescue
|
3808
3686
|
# 알림이 나타나지 않으면 예외 처리하고 넘어감
|
@@ -4015,7 +3893,7 @@ begin
|
|
4015
3893
|
# Alert 처리 부분
|
4016
3894
|
begin
|
4017
3895
|
wait = Selenium::WebDriver::Wait.new(:timeout => 3) # 3초 대기
|
4018
|
-
alert = wait.until { driver.switch_to.alert } # alert가 나타날 때까지 기다림
|
3896
|
+
alert = wait.until { @driver.switch_to.alert } # alert가 나타날 때까지 기다림
|
4019
3897
|
alert.accept # 알림을 확인
|
4020
3898
|
rescue
|
4021
3899
|
# 알림이 나타나지 않으면 예외 처리하고 넘어감
|
@@ -4049,7 +3927,7 @@ login_url = option['login_url'].to_s
|
|
4049
3927
|
# Alert 처리 부분
|
4050
3928
|
begin
|
4051
3929
|
wait = Selenium::WebDriver::Wait.new(:timeout => 3) # 3초 대기
|
4052
|
-
alert = wait.until { driver.switch_to.alert } # alert가 나타날 때까지 기다림
|
3930
|
+
alert = wait.until { @driver.switch_to.alert } # alert가 나타날 때까지 기다림
|
4053
3931
|
alert.accept # 알림을 확인
|
4054
3932
|
rescue
|
4055
3933
|
# 알림이 나타나지 않으면 예외 처리하고 넘어감
|
@@ -4113,9 +3991,9 @@ login_url = option['login_url'].to_s
|
|
4113
3991
|
@driver.execute_script("arguments[0].scrollIntoView({block: 'center', inline: 'center'})", el_post_btn)
|
4114
3992
|
sleep(1)
|
4115
3993
|
@driver.find_element(:xpath, '//*[@class="gRight"]').click
|
4116
|
-
puts '-[√] 글쓰기 버튼 code
|
3994
|
+
puts '-[√] 글쓰기 버튼 code 4.......'.green
|
4117
3995
|
sleep(3.7)
|
4118
|
-
|
3996
|
+
rescue
|
4119
3997
|
|
4120
3998
|
end
|
4121
3999
|
end
|
@@ -4431,11 +4309,19 @@ login_url = option['login_url'].to_s
|
|
4431
4309
|
sleep(1)
|
4432
4310
|
rescue
|
4433
4311
|
end
|
4434
|
-
|
4435
|
-
|
4436
|
-
|
4437
|
-
|
4438
|
-
|
4312
|
+
|
4313
|
+
begin
|
4314
|
+
@driver.execute_script('var elements = document.querySelectorAll("div[style*=\'background-color: rgb(255, 255, 255)\']");
|
4315
|
+
elements.forEach(function(element) {
|
4316
|
+
if (element.style.visibility === "hidden") {
|
4317
|
+
element.remove(); // background-color와 visibility 조건을 만족하면 요소 제거
|
4318
|
+
}
|
4319
|
+
});
|
4320
|
+
')
|
4321
|
+
puts '-[√] 숨김 code 중 12번 code 제거 완료.......'.green
|
4322
|
+
sleep(1)
|
4323
|
+
rescue
|
4324
|
+
end
|
4439
4325
|
|
4440
4326
|
end
|
4441
4327
|
|
@@ -5025,91 +4911,126 @@ login_url = option['login_url'].to_s
|
|
5025
4911
|
|
5026
4912
|
|
5027
4913
|
##닉네임 입력 코드 부분─────────────────────────────────────────────────────────────────────>
|
5028
|
-
puts '-[√] 닉네임
|
4914
|
+
puts '-[√] 닉네임 입력 가능 여부 체크.......'.yellow
|
5029
4915
|
|
5030
4916
|
begin
|
5031
4917
|
@driver.find_element(:xpath, '//*[@id="wr_name"]').send_keys(user_id)
|
5032
4918
|
sleep(1)
|
4919
|
+
puts '-[√] 닉네임 1코드 타겟.......'.yellow
|
5033
4920
|
rescue
|
5034
4921
|
begin
|
5035
4922
|
@driver.find_element(:xpath, '//*[@fw-label="작성자"]').send_keys(user_id)
|
5036
4923
|
sleep(1)
|
4924
|
+
puts '-[√] 닉네임 2코드 타겟.......'.yellow
|
5037
4925
|
rescue
|
5038
4926
|
begin
|
5039
|
-
|
5040
|
-
|
4927
|
+
begin
|
4928
|
+
@driver.find_element(:xpath, '//*[@name="member_display"]').send_keys(user_id)
|
4929
|
+
sleep(1)
|
4930
|
+
puts '-[√] 닉네임 3-1코드 타겟.......'.yellow
|
4931
|
+
rescue
|
4932
|
+
rows = @driver.find_elements(class: 'kboard-attr-row')
|
4933
|
+
rows.each do |row|
|
4934
|
+
begin
|
4935
|
+
input_element = row.find_element(xpath: './/input[@name="member_display"]')
|
4936
|
+
input_element.send_keys(user_id)
|
4937
|
+
sleep(1)
|
4938
|
+
puts '-[√] 닉네임 3-2코드 타겟.......'.yellow
|
4939
|
+
rescue
|
4940
|
+
next
|
4941
|
+
end
|
4942
|
+
end
|
4943
|
+
end
|
5041
4944
|
rescue
|
5042
4945
|
begin
|
5043
4946
|
@driver.find_element(:xpath, '//*[@title="닉네임"]').send_keys(user_id)
|
5044
4947
|
sleep(1)
|
4948
|
+
puts '-[√] 닉네임 4코드 타겟.......'.yellow
|
5045
4949
|
rescue
|
5046
4950
|
begin
|
5047
4951
|
@driver.find_element(:xpath, '//*[@name="name"]').send_keys(user_id)
|
5048
4952
|
sleep(1)
|
4953
|
+
puts '-[√] 닉네임 5코드 타겟.......'.yellow
|
5049
4954
|
rescue
|
5050
4955
|
begin
|
5051
4956
|
@driver.find_element(:xpath, '//*[@name="writer"]').send_keys(user_id)
|
5052
4957
|
sleep(1)
|
4958
|
+
puts '-[√] 닉네임 6코드 타겟.......'.yellow
|
5053
4959
|
rescue
|
5054
4960
|
begin
|
5055
4961
|
@driver.find_element(:xpath, '//*[@name="hname"]').send_keys(user_id)
|
5056
4962
|
sleep(1)
|
4963
|
+
puts '-[√] 닉네임 7코드 타겟.......'.yellow
|
5057
4964
|
rescue
|
5058
4965
|
begin
|
5059
4966
|
@driver.find_element(:xpath, '//*[@name="wr_name"]').send_keys(user_id)
|
5060
4967
|
sleep(1)
|
4968
|
+
puts '-[√] 닉네임 8코드 타겟.......'.yellow
|
5061
4969
|
rescue
|
5062
4970
|
begin
|
5063
4971
|
@driver.find_element(:xpath, '//*[@name="post_nickname"]').send_keys(user_id)
|
5064
4972
|
sleep(1)
|
4973
|
+
puts '-[√] 닉네임 9코드 타겟.......'.yellow
|
5065
4974
|
rescue
|
5066
4975
|
begin
|
5067
4976
|
@driver.find_element(:xpath, '//*[@name="user_name"]').send_keys(user_id)
|
5068
4977
|
sleep(1)
|
4978
|
+
puts '-[√] 닉네임 10코드 타겟.......'.yellow
|
5069
4979
|
rescue
|
5070
4980
|
begin
|
5071
4981
|
@driver.find_element(:xpath, '//*[@class="mb-user-name"]').send_keys(user_id)
|
5072
4982
|
sleep(1)
|
4983
|
+
puts '-[√] 닉네임 11코드 타겟.......'.yellow
|
5073
4984
|
rescue
|
5074
4985
|
begin
|
5075
4986
|
@driver.find_element(:xpath, '//*[@placeholder="비회원 닉네임"]').send_keys(user_id)
|
5076
4987
|
sleep(1)
|
4988
|
+
puts '-[√] 닉네임 12코드 타겟.......'.yellow
|
5077
4989
|
rescue
|
5078
4990
|
begin
|
5079
4991
|
@driver.find_element(:xpath, '//*[@placeholder="이름"]').send_keys(user_id)
|
5080
4992
|
sleep(1)
|
4993
|
+
puts '-[√] 닉네임 13코드 타겟.......'.yellow
|
5081
4994
|
rescue
|
5082
4995
|
begin
|
5083
4996
|
@driver.find_element(:xpath, '//*[@name="nickname"]').send_keys(user_id)
|
5084
4997
|
sleep(1)
|
4998
|
+
puts '-[√] 닉네임 14코드 타겟.......'.yellow
|
5085
4999
|
rescue
|
5086
5000
|
begin
|
5087
5001
|
@driver.find_element(:xpath, '//*[@name="nick"]').send_keys(user_id)
|
5088
5002
|
sleep(1)
|
5003
|
+
puts '-[√] 닉네임 15코드 타겟.......'.yellow
|
5089
5004
|
rescue
|
5090
5005
|
begin
|
5091
5006
|
@driver.find_element(:xpath, '//*[@placeholder="작성자 이름"]').send_keys(user_id)
|
5092
5007
|
sleep(1)
|
5008
|
+
puts '-[√] 닉네임 16코드 타겟.......'.yellow
|
5093
5009
|
rescue
|
5094
5010
|
begin
|
5095
5011
|
@driver.find_element(:xpath, '//*[@id="reg_name"]').send_keys(user_id)
|
5096
5012
|
sleep(1)
|
5013
|
+
puts '-[√] 닉네임 17코드 타겟.......'.yellow
|
5097
5014
|
rescue
|
5098
5015
|
begin
|
5099
5016
|
@driver.find_element(:xpath, '//*[@id="postWriter"]').send_keys(user_id)
|
5100
5017
|
sleep(1)
|
5018
|
+
puts '-[√] 닉네임 18코드 타겟.......'.yellow
|
5101
5019
|
rescue
|
5102
5020
|
begin
|
5103
5021
|
@driver.find_element(:xpath, '//*[@id="kboard-input-member-display"]').send_keys(user_id)
|
5104
5022
|
sleep(1)
|
5023
|
+
puts '-[√] 닉네임 19코드 타겟.......'.yellow
|
5105
5024
|
rescue
|
5106
5025
|
begin
|
5107
5026
|
@driver.find_element(:xpath, '//*[@name="nick_name"]').send_keys(user_id)
|
5108
5027
|
sleep(1)
|
5028
|
+
puts '-[√] 닉네임 20코드 타겟.......'.yellow
|
5109
5029
|
rescue
|
5110
5030
|
begin
|
5111
5031
|
@driver.find_element(:xpath, '//*[@name="write_name"]').send_keys(user_id)
|
5112
5032
|
sleep(1)
|
5033
|
+
puts '-[√] 닉네임 21코드 타겟.......'.yellow
|
5113
5034
|
rescue
|
5114
5035
|
|
5115
5036
|
end
|
@@ -5132,71 +5053,87 @@ begin
|
|
5132
5053
|
end
|
5133
5054
|
end
|
5134
5055
|
end
|
5135
|
-
|
5056
|
+
puts '-[√] 닉네임 입력 가능 여부 종료.......'.yellow
|
5136
5057
|
end
|
5137
5058
|
##<─────────────────────────────────────────────────────────────────────닉네임 입력 코드 부분
|
5138
5059
|
|
5139
5060
|
|
5140
5061
|
##패스워드 입력 코드 부분─────────────────────────────────────────────────────────────────────>
|
5062
|
+
puts '-[√] 패스워드 입력 가능 여부 체크.......'.yellow
|
5141
5063
|
begin
|
5142
5064
|
@driver.find_element(:xpath, '//*[@id="wr_password"]').send_keys(user_pw)
|
5143
5065
|
sleep(1)
|
5066
|
+
puts '-[√] 패스워드 1코드 타겟.......'.yellow
|
5144
5067
|
rescue
|
5145
5068
|
begin
|
5146
5069
|
@driver.find_element(:xpath, '//*[@fw-label="비밀번호"]').send_keys(user_pw)
|
5147
5070
|
sleep(1)
|
5071
|
+
puts '-[√] 패스워드 2코드 타겟.......'.yellow
|
5148
5072
|
rescue
|
5149
5073
|
begin
|
5150
5074
|
@driver.find_element(:xpath, '//*[@name="password"]').send_keys(user_pw)
|
5151
5075
|
sleep(1)
|
5076
|
+
puts '-[√] 패스워드 3코드 타겟.......'.yellow
|
5152
5077
|
rescue
|
5153
5078
|
begin
|
5154
5079
|
@driver.find_element(:xpath, '//*[@title="비밀번호"]').send_keys(user_pw)
|
5155
5080
|
sleep(1)
|
5081
|
+
puts '-[√] 패스워드 4코드 타겟.......'.yellow
|
5156
5082
|
rescue
|
5157
5083
|
begin
|
5158
5084
|
@driver.find_element(:xpath, '//*[@type="password"]').send_keys(user_pw)
|
5159
5085
|
sleep(1)
|
5086
|
+
puts '-[√] 패스워드 5코드 타겟.......'.yellow
|
5160
5087
|
rescue
|
5161
5088
|
begin
|
5162
5089
|
@driver.find_element(:xpath, '//*[@name="wr_password"]').send_keys(user_pw)
|
5163
5090
|
sleep(1)
|
5091
|
+
puts '-[√] 패스워드 6코드 타겟.......'.yellow
|
5164
5092
|
rescue
|
5165
5093
|
begin
|
5166
5094
|
@driver.find_element(:xpath, '//*[@name="passwd"]').send_keys(user_pw)
|
5167
5095
|
sleep(1)
|
5096
|
+
puts '-[√] 패스워드 7코드 타겟.......'.yellow
|
5168
5097
|
rescue
|
5169
5098
|
begin
|
5170
5099
|
@driver.find_element(:xpath, '//*[@name="post_password"]').send_keys(user_pw)
|
5171
5100
|
sleep(1)
|
5101
|
+
puts '-[√] 패스워드 8코드 타겟.......'.yellow
|
5172
5102
|
rescue
|
5173
5103
|
begin
|
5174
5104
|
@driver.find_element(:xpath, '//*[@class="mb-passwd"]').send_keys(user_pw)
|
5175
5105
|
sleep(1)
|
5106
|
+
puts '-[√] 패스워드 9코드 타겟.......'.yellow
|
5176
5107
|
rescue
|
5177
5108
|
begin
|
5178
5109
|
@driver.find_element(:xpath, '//*[@placeholder="비밀번호"]').send_keys(user_pw)
|
5179
5110
|
sleep(1)
|
5111
|
+
puts '-[√] 패스워드 10코드 타겟.......'.yellow
|
5180
5112
|
rescue
|
5181
5113
|
begin
|
5182
5114
|
@driver.find_element(:xpath, '//*[@id="passwd"]').send_keys(user_pw)
|
5183
5115
|
sleep(1)
|
5116
|
+
puts '-[√] 패스워드 11코드 타겟.......'.yellow
|
5184
5117
|
rescue
|
5185
5118
|
begin
|
5186
5119
|
@driver.find_element(:xpath, '//*[@id="blogPostPassword1"]').send_keys(user_pw)
|
5187
5120
|
sleep(1)
|
5121
|
+
puts '-[√] 패스워드 12코드 타겟.......'.yellow
|
5188
5122
|
rescue
|
5189
5123
|
begin
|
5190
5124
|
@driver.find_element(:xpath, '//*[@name="secret_pass"]').send_keys(user_pw)
|
5191
5125
|
sleep(1)
|
5126
|
+
puts '-[√] 패스워드 13코드 타겟.......'.yellow
|
5192
5127
|
rescue
|
5193
5128
|
begin
|
5194
5129
|
@driver.find_element(:xpath, '//*[@id="reg_pwd"]').send_keys(user_pw)
|
5195
5130
|
sleep(1)
|
5131
|
+
puts '-[√] 패스워드 14코드 타겟.......'.yellow
|
5196
5132
|
rescue
|
5197
5133
|
begin
|
5198
5134
|
@driver.find_element(:xpath, '//*[@id="kboard-input-password"]').send_keys(user_pw)
|
5199
5135
|
sleep(1)
|
5136
|
+
puts '-[√] 패스워드 15코드 타겟.......'.yellow
|
5200
5137
|
rescue
|
5201
5138
|
|
5202
5139
|
end
|
@@ -5213,7 +5150,7 @@ begin
|
|
5213
5150
|
end
|
5214
5151
|
end
|
5215
5152
|
end
|
5216
|
-
puts '-[√]
|
5153
|
+
puts '-[√] 패스워드 입력 가능 여부 종료.......'.yellow
|
5217
5154
|
sleep(1)
|
5218
5155
|
end
|
5219
5156
|
##<─────────────────────────────────────────────────────────────────────패스워드 입력 코드 부분
|
@@ -6359,7 +6296,38 @@ rescue
|
|
6359
6296
|
sleep(1)
|
6360
6297
|
puts '내용 항목 코드 타겟 36.......'.red
|
6361
6298
|
rescue
|
6362
|
-
|
6299
|
+
begin
|
6300
|
+
@driver.find_element(:xpath, '//textarea[@id="kboard_content"]').click
|
6301
|
+
sleep(1)
|
6302
|
+
puts '내용 항목 코드 타겟 37.......'.red
|
6303
|
+
rescue
|
6304
|
+
begin
|
6305
|
+
@driver.find_element(:xpath, '//textarea[@class="editor-textarea "]').click
|
6306
|
+
sleep(1)
|
6307
|
+
puts '내용 항목 코드 타겟 38.......'.red
|
6308
|
+
rescue
|
6309
|
+
begin
|
6310
|
+
@driver.find_element(:xpath, '//textarea[@name="kboard_content"]').click
|
6311
|
+
sleep(1)
|
6312
|
+
puts '내용 항목 코드 타겟 39.......'.red
|
6313
|
+
rescue
|
6314
|
+
begin
|
6315
|
+
dev_tools = driver.execute_cdp_cmd('Emulate.DeviceMetrics', {
|
6316
|
+
'width' => 375, # 모바일 화면 너비 (예: iPhone X 너비)
|
6317
|
+
'height' => 667, # 모바일 화면 높이
|
6318
|
+
'deviceScaleFactor' => 3.0, # 화면 비율
|
6319
|
+
'mobile' => true # 모바일 모드 활성화
|
6320
|
+
})
|
6321
|
+
sleep(1)
|
6322
|
+
@driver.find_element(:xpath, '//textarea[@name="kboard_content"]').click
|
6323
|
+
sleep(1)
|
6324
|
+
puts '내용 항목 코드 타겟 40.......'.red
|
6325
|
+
rescue
|
6326
|
+
|
6327
|
+
end
|
6328
|
+
end
|
6329
|
+
end
|
6330
|
+
end
|
6363
6331
|
end
|
6364
6332
|
end
|
6365
6333
|
end
|
@@ -7407,29 +7375,20 @@ begin
|
|
7407
7375
|
@driver.switch_to.default_content()
|
7408
7376
|
#@driver.find_element(:xpath, '//*[@id="mb_kcaptcha"]')
|
7409
7377
|
el = @driver.find_element(:xpath, '//*[@id="mb_kcaptcha"]')
|
7410
|
-
@driver.action.move_to(el).perform
|
7411
7378
|
puts '-[√] 캡챠 발견!! 캡차 해제를 위한 환경설정 약 10초 소요.......'.red
|
7412
7379
|
puts '-[√] 챕챠 해제 중~ 해제 완료까지 마우스 움직이지 마세요.......'.red
|
7413
7380
|
puts '-[√] 챕챠 코드 code 1.......'.red
|
7414
7381
|
sleep(1)
|
7382
|
+
@driver.execute_script("arguments[0].scrollIntoView({behavior: 'smooth', block: 'center', inline: 'center'});", el) # 화면 가운데
|
7383
|
+
sleep(1)
|
7415
7384
|
mouse_move_percentage(0.3,0.02)
|
7416
7385
|
sleep(0.5)
|
7417
|
-
left_click
|
7386
|
+
left_click
|
7418
7387
|
sleep(1)
|
7419
|
-
@driver.
|
7388
|
+
@driver.switch_to.window(@driver.window_handle) #핸들 주입
|
7389
|
+
@driver.action.context_click(el).perform #우 클릭
|
7420
7390
|
sleep(1)
|
7421
|
-
|
7422
|
-
#sleep(2)
|
7423
|
-
#@driver.manage.window.maximize
|
7424
|
-
|
7425
|
-
|
7426
|
-
el1 = @driver.find_element(:xpath, '//*[@id="mb_kcaptcha"]')
|
7427
|
-
@driver.action.context_click(el1).perform
|
7428
|
-
sleep(1)
|
7429
|
-
@driver.action.key_down(:shift).key_stroke('m').key_up(:shift).perform #컨트롤+a
|
7430
|
-
#key_down('shift')
|
7431
|
-
#key_stroke('m')
|
7432
|
-
#key_up('shift')
|
7391
|
+
@driver.action.key_down(:shift).key_stroke('m').key_up(:shift).perform #단축키
|
7433
7392
|
sleep(1)
|
7434
7393
|
puts '-[√] 캡챠 코드 타겟 완료1.......'.blue
|
7435
7394
|
rescue
|
@@ -7437,29 +7396,20 @@ rescue
|
|
7437
7396
|
@driver.switch_to.default_content()
|
7438
7397
|
#@driver.find_element(:xpath, '//*[@alt="자동등록방지"]')
|
7439
7398
|
el = @driver.find_element(:xpath, '//*[@alt="자동등록방지"]')
|
7440
|
-
@driver.action.move_to(el).perform
|
7441
7399
|
puts '-[√] 캡챠 발견!! 캡차 해제를 위한 환경설정 약 10초 소요.......'.red
|
7442
7400
|
puts '-[√] 챕챠 해제 중~ 해제 완료까지 마우스 움직이지 마세요.......'.red
|
7443
7401
|
puts '-[√] 챕챠 코드 code 2.......'.red
|
7444
7402
|
sleep(1)
|
7403
|
+
@driver.execute_script("arguments[0].scrollIntoView({behavior: 'smooth', block: 'center', inline: 'center'});", el) # 화면 가운데
|
7404
|
+
sleep(1)
|
7445
7405
|
mouse_move_percentage(0.3,0.02)
|
7446
7406
|
sleep(0.5)
|
7447
|
-
left_click
|
7407
|
+
left_click
|
7448
7408
|
sleep(1)
|
7449
|
-
@driver.
|
7409
|
+
@driver.switch_to.window(@driver.window_handle) #핸들 주입
|
7410
|
+
@driver.action.context_click(el).perform #우 클릭
|
7450
7411
|
sleep(1)
|
7451
|
-
|
7452
|
-
#sleep(2)
|
7453
|
-
#@driver.manage.window.maximize
|
7454
|
-
|
7455
|
-
|
7456
|
-
el1 = @driver.find_element(:xpath, '//*[@alt="자동등록방지"]')
|
7457
|
-
@driver.action.context_click(el1).perform
|
7458
|
-
sleep(1)
|
7459
|
-
@driver.action.key_down(:shift).key_stroke('m').key_up(:shift).perform #컨트롤+a
|
7460
|
-
#key_down('shift')
|
7461
|
-
#key_stroke('m')
|
7462
|
-
#key_up('shift')
|
7412
|
+
@driver.action.key_down(:shift).key_stroke('m').key_up(:shift).perform #단축키
|
7463
7413
|
sleep(1)
|
7464
7414
|
puts '-[√] 캡챠 코드 타겟 완료1.......'.blue
|
7465
7415
|
rescue
|
@@ -7468,7 +7418,6 @@ rescue
|
|
7468
7418
|
sleep(1)
|
7469
7419
|
#@driver.find_element(:xpath, '//*[@id="captcha_img"]').send_keys(:tab)
|
7470
7420
|
el = @driver.find_element(:xpath, '//*[@id="captcha_img"]')
|
7471
|
-
@driver.action.move_to(el).perform
|
7472
7421
|
puts '-[√] 캡챠 발견!! 캡차 해제를 위한 환경설정 약 10초 소요.......'.red
|
7473
7422
|
puts '-[√] 챕챠 해제 중~ 해제 완료까지 마우스 움직이지 마세요.......'.red
|
7474
7423
|
puts '-[√] 챕챠 코드 code 3.......'.red
|
@@ -7478,23 +7427,17 @@ rescue
|
|
7478
7427
|
@driver.execute_script("arguments[0].remove();", chat_box)
|
7479
7428
|
sleep(1)
|
7480
7429
|
|
7430
|
+
sleep(1)
|
7431
|
+
@driver.execute_script("arguments[0].scrollIntoView({behavior: 'smooth', block: 'center', inline: 'center'});", el) # 화면 가운데
|
7432
|
+
sleep(1)
|
7481
7433
|
mouse_move_percentage(0.3,0.02)
|
7482
7434
|
sleep(0.5)
|
7483
|
-
left_click
|
7435
|
+
left_click
|
7484
7436
|
sleep(1)
|
7485
|
-
@driver.
|
7437
|
+
@driver.switch_to.window(@driver.window_handle) #핸들 주입
|
7438
|
+
@driver.action.context_click(el).perform #우 클릭
|
7486
7439
|
sleep(1)
|
7487
|
-
|
7488
|
-
|
7489
|
-
|
7490
|
-
|
7491
|
-
el1 = @driver.find_element(:xpath, '//*[@id="captcha_img"]')
|
7492
|
-
@driver.action.context_click(el1).perform
|
7493
|
-
sleep(1)
|
7494
|
-
@driver.action.key_down(:shift).key_stroke('m').key_up(:shift).perform #컨트롤+a
|
7495
|
-
#key_down('shift')
|
7496
|
-
#key_stroke('m')
|
7497
|
-
#key_up('shift')
|
7440
|
+
@driver.action.key_down(:shift).key_stroke('m').key_up(:shift).perform #단축키
|
7498
7441
|
sleep(1)
|
7499
7442
|
puts '-[√] 캡챠 코드 타겟 완료1.......'.blue
|
7500
7443
|
rescue
|
@@ -7502,250 +7445,226 @@ rescue
|
|
7502
7445
|
@driver.switch_to.default_content()
|
7503
7446
|
#@driver.find_element(:xpath, '//*[@id="kcaptcha"]')
|
7504
7447
|
el = @driver.find_element(:xpath, '//*[@id="kcaptcha"]')
|
7505
|
-
@driver.action.move_to(el).perform
|
7506
7448
|
puts '-[√] 캡챠 발견!! 캡차 해제를 위한 환경설정 약 10초 소요.......'.red
|
7507
7449
|
puts '-[√] 챕챠 해제 중~ 해제 완료까지 마우스 움직이지 마세요.......'.red
|
7508
7450
|
puts '-[√] 챕챠 코드 code 4.......'.red
|
7509
7451
|
sleep(1)
|
7452
|
+
@driver.execute_script("arguments[0].scrollIntoView({behavior: 'smooth', block: 'center', inline: 'center'});", el) # 화면 가운데
|
7453
|
+
sleep(1)
|
7510
7454
|
mouse_move_percentage(0.3,0.02)
|
7511
7455
|
sleep(0.5)
|
7512
|
-
left_click
|
7456
|
+
left_click
|
7513
7457
|
sleep(1)
|
7514
|
-
@driver.
|
7458
|
+
@driver.switch_to.window(@driver.window_handle) #핸들 주입
|
7459
|
+
@driver.action.context_click(el).perform #우 클릭
|
7515
7460
|
sleep(1)
|
7516
|
-
|
7517
|
-
#sleep(2)
|
7518
|
-
#@driver.manage.window.maximize
|
7519
|
-
|
7520
|
-
|
7521
|
-
el1 = @driver.find_element(:xpath, '//*[@id="kcaptcha"]')
|
7522
|
-
@driver.action.context_click(el1).perform
|
7523
|
-
sleep(1)
|
7524
|
-
@driver.action.key_down(:shift).key_stroke('m').key_up(:shift).perform #컨트롤+a
|
7525
|
-
#key_down('shift')
|
7526
|
-
#key_stroke('m')
|
7527
|
-
#key_up('shift')
|
7461
|
+
@driver.action.key_down(:shift).key_stroke('m').key_up(:shift).perform #단축키
|
7528
7462
|
sleep(1)
|
7529
7463
|
puts '-[√] 캡챠 코드 타겟 완료1.......'.blue
|
7530
7464
|
rescue
|
7531
7465
|
begin
|
7532
7466
|
@driver.switch_to.default_content()
|
7533
|
-
|
7534
|
-
|
7535
|
-
|
7467
|
+
@driver.find_elements(:tag_name, 'img').each do |img|
|
7468
|
+
if img.attribute('src').include?('kboard_captcha')
|
7469
|
+
el = img # 캡챠 이미지를 el에 저장
|
7470
|
+
break # 첫 번째 이미지를 찾으면 루프 종료
|
7471
|
+
end
|
7472
|
+
end
|
7536
7473
|
puts '-[√] 캡챠 발견!! 캡차 해제를 위한 환경설정 약 10초 소요.......'.red
|
7537
7474
|
puts '-[√] 챕챠 해제 중~ 해제 완료까지 마우스 움직이지 마세요.......'.red
|
7538
|
-
puts '-[√] 챕챠 코드 code 5.......'.red
|
7475
|
+
puts '-[√] 챕챠 코드 code 5-1.......'.red
|
7476
|
+
sleep(1)
|
7477
|
+
@driver.execute_script("arguments[0].scrollIntoView({behavior: 'smooth', block: 'center', inline: 'center'});", el) # 화면 가운데
|
7539
7478
|
sleep(1)
|
7540
7479
|
mouse_move_percentage(0.3,0.02)
|
7541
7480
|
sleep(0.5)
|
7542
|
-
left_click
|
7543
|
-
sleep(1)
|
7544
|
-
@driver.find_element(:xpath, '//*[@for="kboard-input-captcha"]').click
|
7481
|
+
left_click
|
7545
7482
|
sleep(1)
|
7546
|
-
|
7547
|
-
|
7548
|
-
#@driver.manage.window.maximize
|
7549
|
-
|
7550
|
-
el1 = @driver.find_element(:xpath, '//*[@for="kboard-input-captcha"]')
|
7551
|
-
@driver.action.context_click(el1).perform
|
7483
|
+
@driver.switch_to.window(@driver.window_handle) #핸들 주입
|
7484
|
+
@driver.action.context_click(el).perform #우 클릭
|
7552
7485
|
sleep(1)
|
7553
|
-
@driver.action.key_down(:shift).key_stroke('m').key_up(:shift).perform
|
7554
|
-
#key_down('shift')
|
7555
|
-
#key_stroke('m')
|
7556
|
-
#key_up('shift')
|
7486
|
+
@driver.action.key_down(:shift).key_stroke('m').key_up(:shift).perform #단축키
|
7557
7487
|
sleep(1)
|
7558
7488
|
puts '-[√] 캡챠 코드 타겟 완료1.......'.blue
|
7559
7489
|
rescue
|
7560
7490
|
begin
|
7561
7491
|
@driver.switch_to.default_content()
|
7562
|
-
|
7563
|
-
|
7564
|
-
el = @driver.find_element(:xpath, '//*[@id="captcha_Write"]')
|
7565
|
-
@driver.action.move_to(el).perform
|
7492
|
+
#@driver.find_element(:xpath, '//*[@for="kboard-input-captcha"]')
|
7493
|
+
el = @driver.find_element(:css, 'label[for="kboard-input-captcha"] img')
|
7566
7494
|
puts '-[√] 캡챠 발견!! 캡차 해제를 위한 환경설정 약 10초 소요.......'.red
|
7567
7495
|
puts '-[√] 챕챠 해제 중~ 해제 완료까지 마우스 움직이지 마세요.......'.red
|
7568
|
-
puts '-[√] 챕챠 코드 code
|
7496
|
+
puts '-[√] 챕챠 코드 code 5-2.......'.red
|
7497
|
+
sleep(1)
|
7498
|
+
@driver.execute_script("arguments[0].scrollIntoView({behavior: 'smooth', block: 'center', inline: 'center'});", el) # 화면 가운데
|
7569
7499
|
sleep(1)
|
7570
7500
|
mouse_move_percentage(0.3,0.02)
|
7571
7501
|
sleep(0.5)
|
7572
|
-
left_click
|
7502
|
+
left_click
|
7573
7503
|
sleep(1)
|
7574
|
-
@driver.
|
7504
|
+
@driver.switch_to.window(@driver.window_handle) #핸들 주입
|
7505
|
+
@driver.action.context_click(el).perform #우 클릭
|
7575
7506
|
sleep(1)
|
7576
|
-
|
7577
|
-
#sleep(2)
|
7578
|
-
#@driver.manage.window.maximize
|
7579
|
-
|
7580
|
-
|
7581
|
-
el1 = @driver.find_element(:xpath, '//*[@id="captcha_Write"]')
|
7582
|
-
@driver.action.context_click(el1).perform
|
7583
|
-
sleep(1)
|
7584
|
-
@driver.action.key_down(:shift).key_stroke('m').key_up(:shift).perform #컨트롤+a
|
7585
|
-
#key_down('shift')
|
7586
|
-
#key_stroke('m')
|
7587
|
-
#key_up('shift')
|
7507
|
+
@driver.action.key_down(:shift).key_stroke('m').key_up(:shift).perform #단축키
|
7588
7508
|
sleep(1)
|
7589
7509
|
puts '-[√] 캡챠 코드 타겟 완료1.......'.blue
|
7590
7510
|
rescue
|
7591
7511
|
begin
|
7592
7512
|
@driver.switch_to.default_content()
|
7593
|
-
|
7594
|
-
|
7595
|
-
@driver.
|
7513
|
+
sleep(1)
|
7514
|
+
#@driver.find_element(:xpath, '//*[@id="captcha_Write"]')
|
7515
|
+
el = @driver.find_element(:xpath, '//*[@id="captcha_Write"]')
|
7596
7516
|
puts '-[√] 캡챠 발견!! 캡차 해제를 위한 환경설정 약 10초 소요.......'.red
|
7597
7517
|
puts '-[√] 챕챠 해제 중~ 해제 완료까지 마우스 움직이지 마세요.......'.red
|
7598
|
-
puts '-[√] 챕챠 코드 code
|
7518
|
+
puts '-[√] 챕챠 코드 code 6.......'.red
|
7519
|
+
sleep(1)
|
7520
|
+
@driver.execute_script("arguments[0].scrollIntoView({behavior: 'smooth', block: 'center', inline: 'center'});", el) # 화면 가운데
|
7599
7521
|
sleep(1)
|
7600
7522
|
mouse_move_percentage(0.3,0.02)
|
7601
7523
|
sleep(0.5)
|
7602
|
-
left_click
|
7524
|
+
left_click
|
7603
7525
|
sleep(1)
|
7604
|
-
@driver.
|
7526
|
+
@driver.switch_to.window(@driver.window_handle) #핸들 주입
|
7527
|
+
@driver.action.context_click(el).perform #우 클릭
|
7605
7528
|
sleep(1)
|
7606
|
-
|
7607
|
-
#sleep(2)
|
7608
|
-
#@driver.manage.window.maximize
|
7609
|
-
|
7610
|
-
|
7611
|
-
el1 = @driver.find_element(:xpath, '//*[@image-reader="in-progress"]')
|
7612
|
-
@driver.action.context_click(el1).perform
|
7613
|
-
sleep(1)
|
7614
|
-
@driver.action.key_down(:shift).key_stroke('m').key_up(:shift).perform #컨트롤+a
|
7615
|
-
#key_down('shift')
|
7616
|
-
#key_stroke('m')
|
7617
|
-
#key_up('shift')
|
7529
|
+
@driver.action.key_down(:shift).key_stroke('m').key_up(:shift).perform #단축키
|
7618
7530
|
sleep(1)
|
7619
7531
|
puts '-[√] 캡챠 코드 타겟 완료1.......'.blue
|
7620
7532
|
rescue
|
7621
7533
|
begin
|
7622
7534
|
@driver.switch_to.default_content()
|
7623
|
-
#@driver.find_element(:xpath, '//*[@
|
7624
|
-
el = @driver.find_element(:xpath, '//*[@
|
7625
|
-
@driver.action.move_to(el).perform
|
7535
|
+
#@driver.find_element(:xpath, '//*[@image-reader="in-progress"]')
|
7536
|
+
el = @driver.find_element(:xpath, '//*[@image-reader="in-progress"]')
|
7626
7537
|
puts '-[√] 캡챠 발견!! 캡차 해제를 위한 환경설정 약 10초 소요.......'.red
|
7627
7538
|
puts '-[√] 챕챠 해제 중~ 해제 완료까지 마우스 움직이지 마세요.......'.red
|
7628
|
-
puts '-[√] 챕챠 코드 code
|
7539
|
+
puts '-[√] 챕챠 코드 code 7.......'.red
|
7540
|
+
sleep(1)
|
7541
|
+
@driver.execute_script("arguments[0].scrollIntoView({behavior: 'smooth', block: 'center', inline: 'center'});", el) # 화면 가운데
|
7629
7542
|
sleep(1)
|
7630
7543
|
mouse_move_percentage(0.3,0.02)
|
7631
7544
|
sleep(0.5)
|
7632
|
-
left_click
|
7545
|
+
left_click
|
7633
7546
|
sleep(1)
|
7634
|
-
@driver.
|
7635
|
-
|
7636
|
-
#@driver.manage.window.position = Selenium::WebDriver::Point.new(0, 0)
|
7637
|
-
#sleep(2)
|
7638
|
-
#@driver.manage.window.maximize
|
7639
|
-
|
7640
|
-
|
7641
|
-
el1 = @driver.find_element(:xpath, '//*[@id="spamauth"]')
|
7642
|
-
@driver.action.context_click(el1).perform
|
7547
|
+
@driver.switch_to.window(@driver.window_handle) #핸들 주입
|
7548
|
+
@driver.action.context_click(el).perform #우 클릭
|
7643
7549
|
sleep(1)
|
7644
|
-
@driver.action.key_down(:shift).key_stroke('m').key_up(:shift).perform
|
7645
|
-
#key_down('shift')
|
7646
|
-
#key_stroke('m')
|
7647
|
-
#key_up('shift')
|
7550
|
+
@driver.action.key_down(:shift).key_stroke('m').key_up(:shift).perform #단축키
|
7648
7551
|
sleep(1)
|
7649
7552
|
puts '-[√] 캡챠 코드 타겟 완료1.......'.blue
|
7650
7553
|
rescue
|
7651
7554
|
begin
|
7652
7555
|
@driver.switch_to.default_content()
|
7653
|
-
#@driver.find_element(:xpath, '//*[@id="
|
7654
|
-
el = @driver.find_element(:xpath, '//*[@id="
|
7655
|
-
@driver.action.move_to(el).perform
|
7556
|
+
#@driver.find_element(:xpath, '//*[@id="spamauth"]')
|
7557
|
+
el = @driver.find_element(:xpath, '//*[@id="spamauth"]')
|
7656
7558
|
puts '-[√] 캡챠 발견!! 캡차 해제를 위한 환경설정 약 10초 소요.......'.red
|
7657
7559
|
puts '-[√] 챕챠 해제 중~ 해제 완료까지 마우스 움직이지 마세요.......'.red
|
7658
|
-
puts '-[√] 챕챠 코드 code
|
7560
|
+
puts '-[√] 챕챠 코드 code 8.......'.red
|
7561
|
+
sleep(1)
|
7562
|
+
@driver.execute_script("arguments[0].scrollIntoView({behavior: 'smooth', block: 'center', inline: 'center'});", el) # 화면 가운데
|
7659
7563
|
sleep(1)
|
7660
7564
|
mouse_move_percentage(0.3,0.02)
|
7661
7565
|
sleep(0.5)
|
7662
|
-
left_click
|
7663
|
-
sleep(1)
|
7664
|
-
@driver.find_element(:xpath, '//*[@id="norobot_img"]').click
|
7566
|
+
left_click
|
7665
7567
|
sleep(1)
|
7666
|
-
|
7667
|
-
|
7668
|
-
#@driver.manage.window.maximize
|
7669
|
-
|
7670
|
-
|
7671
|
-
el1 = @driver.find_element(:xpath, '//*[@id="norobot_img"]')
|
7672
|
-
@driver.action.context_click(el1).perform
|
7568
|
+
@driver.switch_to.window(@driver.window_handle) #핸들 주입
|
7569
|
+
@driver.action.context_click(el).perform #우 클릭
|
7673
7570
|
sleep(1)
|
7674
|
-
@driver.action.key_down(:shift).key_stroke('m').key_up(:shift).perform
|
7675
|
-
#key_down('shift')
|
7676
|
-
#key_stroke('m')
|
7677
|
-
#key_up('shift')
|
7571
|
+
@driver.action.key_down(:shift).key_stroke('m').key_up(:shift).perform #단축키
|
7678
7572
|
sleep(1)
|
7679
7573
|
puts '-[√] 캡챠 코드 타겟 완료1.......'.blue
|
7680
7574
|
rescue
|
7681
7575
|
begin
|
7682
7576
|
@driver.switch_to.default_content()
|
7683
|
-
#@driver.find_element(:xpath, '//*[@
|
7684
|
-
el = @driver.find_element(:xpath, '//*[@
|
7685
|
-
@driver.action.move_to(el).perform
|
7577
|
+
#@driver.find_element(:xpath, '//*[@id="norobot_img"]')
|
7578
|
+
el = @driver.find_element(:xpath, '//*[@id="norobot_img"]')
|
7686
7579
|
puts '-[√] 캡챠 발견!! 캡차 해제를 위한 환경설정 약 10초 소요.......'.red
|
7687
7580
|
puts '-[√] 챕챠 해제 중~ 해제 완료까지 마우스 움직이지 마세요.......'.red
|
7688
|
-
puts '-[√] 챕챠 코드 code
|
7581
|
+
puts '-[√] 챕챠 코드 code 9.......'.red
|
7582
|
+
sleep(1)
|
7583
|
+
@driver.execute_script("arguments[0].scrollIntoView({behavior: 'smooth', block: 'center', inline: 'center'});", el) # 화면 가운데
|
7689
7584
|
sleep(1)
|
7690
7585
|
mouse_move_percentage(0.3,0.02)
|
7691
7586
|
sleep(0.5)
|
7692
|
-
left_click
|
7693
|
-
sleep(1)
|
7694
|
-
@driver.find_element(:xpath, '//*[@class="CodeImage"]').click
|
7587
|
+
left_click
|
7695
7588
|
sleep(1)
|
7696
|
-
|
7697
|
-
|
7698
|
-
#@driver.manage.window.maximize
|
7699
|
-
|
7700
|
-
|
7701
|
-
el1 = @driver.find_element(:xpath, '//*[@class="CodeImage"]')
|
7702
|
-
@driver.action.context_click(el1).perform
|
7589
|
+
@driver.switch_to.window(@driver.window_handle) #핸들 주입
|
7590
|
+
@driver.action.context_click(el).perform #우 클릭
|
7703
7591
|
sleep(1)
|
7704
|
-
@driver.action.key_down(:shift).key_stroke('m').key_up(:shift).perform
|
7705
|
-
#key_down('shift')
|
7706
|
-
#key_stroke('m')
|
7707
|
-
#key_up('shift')
|
7592
|
+
@driver.action.key_down(:shift).key_stroke('m').key_up(:shift).perform #단축키
|
7708
7593
|
sleep(1)
|
7709
7594
|
puts '-[√] 캡챠 코드 타겟 완료1.......'.blue
|
7710
7595
|
rescue
|
7711
7596
|
begin
|
7712
7597
|
@driver.switch_to.default_content()
|
7713
|
-
|
7714
|
-
el = @driver.find_element(:xpath, '//*[@id="kcaptcha_image"]')
|
7715
|
-
@driver.action.move_to(el).perform
|
7598
|
+
el = @driver.find_element(:xpath, '//*[@class="CodeImage"]')
|
7716
7599
|
puts '-[√] 캡챠 발견!! 캡차 해제를 위한 환경설정 약 10초 소요.......'.red
|
7717
7600
|
puts '-[√] 챕챠 해제 중~ 해제 완료까지 마우스 움직이지 마세요.......'.red
|
7718
|
-
puts '-[√] 챕챠 코드 code
|
7601
|
+
puts '-[√] 챕챠 코드 code 10.......'.red
|
7602
|
+
sleep(1)
|
7603
|
+
@driver.execute_script("arguments[0].scrollIntoView({behavior: 'smooth', block: 'center', inline: 'center'});", el) # 화면 가운데
|
7719
7604
|
sleep(1)
|
7720
7605
|
mouse_move_percentage(0.3,0.02)
|
7721
7606
|
sleep(0.5)
|
7722
|
-
left_click
|
7607
|
+
left_click
|
7723
7608
|
sleep(1)
|
7724
|
-
@driver.
|
7725
|
-
|
7726
|
-
#@driver.manage.window.position = Selenium::WebDriver::Point.new(0, 0)
|
7727
|
-
#sleep(2)
|
7728
|
-
#@driver.manage.window.maximize
|
7729
|
-
|
7730
|
-
|
7731
|
-
el1 = @driver.find_element(:xpath, '//*[@id="kcaptcha_image"]')
|
7732
|
-
@driver.action.context_click(el1).perform
|
7609
|
+
@driver.switch_to.window(@driver.window_handle) #핸들 주입
|
7610
|
+
@driver.action.context_click(el).perform #우 클릭
|
7733
7611
|
sleep(1)
|
7734
|
-
@driver.action.key_down(:shift).key_stroke('m').key_up(:shift).perform
|
7735
|
-
#key_down('shift')
|
7736
|
-
#key_stroke('m')
|
7737
|
-
#key_up('shift')
|
7612
|
+
@driver.action.key_down(:shift).key_stroke('m').key_up(:shift).perform #단축키
|
7738
7613
|
sleep(1)
|
7739
7614
|
puts '-[√] 캡챠 코드 타겟 완료1.......'.blue
|
7740
7615
|
rescue
|
7741
|
-
|
7742
|
-
|
7616
|
+
begin
|
7617
|
+
@driver.switch_to.default_content()
|
7618
|
+
el = @driver.find_element(:xpath, '//*[@id="kcaptcha_image"]')
|
7619
|
+
puts '-[√] 캡챠 발견!! 캡차 해제를 위한 환경설정 약 10초 소요.......'.red
|
7620
|
+
puts '-[√] 챕챠 해제 중~ 해제 완료까지 마우스 움직이지 마세요.......'.red
|
7621
|
+
puts '-[√] 챕챠 코드 code 11.......'.red
|
7622
|
+
sleep(1)
|
7623
|
+
@driver.execute_script("arguments[0].scrollIntoView({behavior: 'smooth', block: 'center', inline: 'center'});", el) # 화면 가운데
|
7624
|
+
sleep(1)
|
7625
|
+
mouse_move_percentage(0.3,0.02)
|
7626
|
+
sleep(0.5)
|
7627
|
+
left_click
|
7628
|
+
sleep(1)
|
7629
|
+
@driver.switch_to.window(@driver.window_handle) #핸들 주입
|
7630
|
+
@driver.action.context_click(el).perform #우 클릭
|
7631
|
+
sleep(1)
|
7632
|
+
@driver.action.key_down(:shift).key_stroke('m').key_up(:shift).perform #단축키
|
7633
|
+
sleep(1)
|
7634
|
+
puts '-[√] 캡챠 코드 타겟 완료1.......'.blue
|
7635
|
+
rescue
|
7636
|
+
begin
|
7637
|
+
@driver.switch_to.default_content()
|
7638
|
+
el = @driver.find_element(:xpath, '//*[@class="lazy-loaded"]')
|
7639
|
+
puts '-[√] 캡챠 발견!! 캡차 해제를 위한 환경설정 약 10초 소요.......'.red
|
7640
|
+
puts '-[√] 챕챠 해제 중~ 해제 완료까지 마우스 움직이지 마세요.......'.red
|
7641
|
+
puts '-[√] 챕챠 코드 code 12.......'.red
|
7642
|
+
sleep(1)
|
7643
|
+
@driver.execute_script("arguments[0].scrollIntoView({behavior: 'smooth', block: 'center', inline: 'center'});", el) # 화면 가운데
|
7644
|
+
sleep(1)
|
7645
|
+
mouse_move_percentage(0.3,0.02)
|
7646
|
+
sleep(0.5)
|
7647
|
+
left_click
|
7648
|
+
sleep(1)
|
7649
|
+
@driver.switch_to.window(@driver.window_handle) #핸들 주입
|
7650
|
+
@driver.action.context_click(el).perform #우 클릭
|
7651
|
+
sleep(1)
|
7652
|
+
@driver.action.key_down(:shift).key_stroke('m').key_up(:shift).perform #단축키
|
7653
|
+
sleep(1)
|
7654
|
+
puts '-[√] 캡챠 코드 타겟 완료1.......'.blue
|
7655
|
+
rescue
|
7656
|
+
|
7657
|
+
end
|
7658
|
+
end
|
7659
|
+
|
7660
|
+
end
|
7743
7661
|
end
|
7744
7662
|
end
|
7745
7663
|
end
|
7746
7664
|
end
|
7747
7665
|
end
|
7748
7666
|
end
|
7667
|
+
|
7749
7668
|
end
|
7750
7669
|
end
|
7751
7670
|
end
|
@@ -7938,23 +7857,22 @@ rescue
|
|
7938
7857
|
rescue
|
7939
7858
|
begin
|
7940
7859
|
@driver.find_element(:xpath, '//*[@name="captcha"]').click
|
7941
|
-
|
7942
7860
|
sleep(1)
|
7943
|
-
|
7861
|
+
|
7862
|
+
# CAPTCHA 요소 찾기
|
7944
7863
|
el2 = @driver.find_element(:xpath, '//*[@name="captcha"]')
|
7864
|
+
|
7865
|
+
# 우클릭 (context_click) 실행
|
7945
7866
|
@driver.action.context_click(el2).perform
|
7946
|
-
|
7947
7867
|
sleep(1)
|
7948
7868
|
@driver.action.key_stroke('up')
|
7949
7869
|
sleep(1)
|
7950
7870
|
@driver.action.key_stroke('up')
|
7951
7871
|
sleep(1)
|
7952
7872
|
@driver.action.key_stroke('enter')
|
7953
|
-
sleep(1)
|
7954
7873
|
begin
|
7955
|
-
# 요소 찾기 타임아웃을 7초로 설정
|
7956
7874
|
wait = Selenium::WebDriver::Wait.new(:timeout => 7)
|
7957
|
-
|
7875
|
+
# 요소가 나타날 때까지 7초 동안 기다립니다.
|
7958
7876
|
wait.until { @driver.find_element(:xpath, '//*[@class="captcha-solver captcha-solver_inner"]') }
|
7959
7877
|
rescue
|
7960
7878
|
sleep(1)
|
@@ -9504,7 +9422,7 @@ class Wordpress
|
|
9504
9422
|
puts 'Tethering IP change...'
|
9505
9423
|
|
9506
9424
|
stdout, stderr, status = Open3.capture3('./adb devices')
|
9507
|
-
|
9425
|
+
|
9508
9426
|
if status.success?
|
9509
9427
|
device_id = stdout.split("\n")[1].split("\t")[0]
|
9510
9428
|
puts device_id
|
@@ -9512,42 +9430,53 @@ class Wordpress
|
|
9512
9430
|
# ADB 서버 초기화
|
9513
9431
|
puts 'adb kill-server'
|
9514
9432
|
Open3.capture3('./adb kill-server')
|
9515
|
-
sleep(
|
9433
|
+
sleep(5) # ADB 서버가 안정될 시간을 충분히 주기
|
9516
9434
|
|
9517
9435
|
# 다시 ADB 서버 실행
|
9518
9436
|
puts 'adb start-server'
|
9519
9437
|
Open3.capture3('./adb start-server')
|
9520
|
-
sleep(
|
9438
|
+
sleep(5) # ADB 서버가 안정될 시간을 충분히 주기
|
9521
9439
|
|
9522
9440
|
# 데이터를 끄고 켜기
|
9523
9441
|
puts 'adb -s ' + device_id + ' shell svc data disable'
|
9524
|
-
stdout2, stderr2, status2 = Open3.capture3('./adb -s '+device_id+' shell svc data disable')
|
9525
|
-
|
9442
|
+
stdout2, stderr2, status2 = Open3.capture3('./adb -s ' + device_id + ' shell svc data disable')
|
9443
|
+
puts "stderr: #{stderr2}" unless status2.success? # 오류 출력
|
9444
|
+
sleep(5) # 네트워크가 안정될 시간을 더 줍니다.
|
9526
9445
|
puts 'adb -s ' + device_id + ' shell svc data enable'
|
9527
|
-
Open3.capture3('./adb -s '+device_id+' shell svc data enable')
|
9528
|
-
|
9446
|
+
stdout3, stderr3, status3 = Open3.capture3('./adb -s ' + device_id + ' shell svc data enable')
|
9447
|
+
puts "stderr: #{stderr3}" unless status3.success? # 오류 출력
|
9448
|
+
sleep(5) # 네트워크가 안정될 시간을 더 줍니다.
|
9529
9449
|
puts 'adb ok'
|
9530
9450
|
sleep(8)
|
9531
|
-
|
9451
|
+
|
9452
|
+
# IP 변경 확인을 위한 람다 함수
|
9532
9453
|
robot_ip = lambda do
|
9533
|
-
|
9534
|
-
|
9535
|
-
|
9536
|
-
|
9454
|
+
begin
|
9455
|
+
# IP 변경 확인
|
9456
|
+
http = HTTP.get('https://www.findip.kr/')
|
9457
|
+
noko = Nokogiri::HTML(http.to_s)
|
9458
|
+
|
9459
|
+
current_ip = noko.xpath('/html/body/header/h2').text.strip
|
9460
|
+
if current_ip != @my_ip
|
9461
|
+
@my_ip = current_ip
|
9537
9462
|
puts "IP 변경됨[ #{@my_ip} ]"
|
9538
|
-
|
9539
|
-
puts @my_ip
|
9540
|
-
puts '
|
9541
|
-
sleep(
|
9542
|
-
robot_ip[]
|
9463
|
+
else
|
9464
|
+
puts "현재 IP: #{@my_ip}"
|
9465
|
+
puts 'IP 변경이 감지되지 않았습니다. 다시 시도합니다...'
|
9466
|
+
sleep(5) # 여유롭게 대기 시간 증가
|
9467
|
+
robot_ip[] # 재시도
|
9468
|
+
end
|
9469
|
+
rescue HTTP::ConnectionError => e
|
9470
|
+
puts "네트워크 오류 발생: #{e.message}. 재시도 중..."
|
9471
|
+
sleep(5) # 재시도 간 여유 시간 추가
|
9472
|
+
retry # 재시도
|
9543
9473
|
end
|
9544
|
-
|
9545
|
-
|
9546
|
-
|
9474
|
+
end
|
9475
|
+
robot_ip[] # IP 확인 시작
|
9547
9476
|
else
|
9548
|
-
|
9477
|
+
puts "adb devices 명령어 실행 실패. stderr: #{stderr}"
|
9549
9478
|
end
|
9550
|
-
|
9479
|
+
end
|
9551
9480
|
|
9552
9481
|
check_success = 1
|
9553
9482
|
@data['table'][index][-1] = 0
|