質問編集履歴

3

ソース修正

2021/10/29 05:17

投稿

ryoma26
ryoma26

スコア6

test CHANGED
File without changes
test CHANGED
@@ -26,6 +26,16 @@
26
26
 
27
27
 
28
28
 
29
+
30
+
31
+ function click() {
32
+
33
+ document.querySelector(".cart-button").click();
34
+
35
+ }
36
+
37
+
38
+
29
39
  const start=new Date(2021,9,24,21,00,00);
30
40
 
31
41
  const Timer=setInterval(Time,1000);
@@ -36,21 +46,21 @@
36
46
 
37
47
 
38
48
 
39
- chrome.tabs.create({url: "https://ticket.rakuten.co.jp/music/jpop/RTZPALD/"}, tab => {
49
+ chrome.tabs.create({url: "https://ticket.rakuten.co.jp/music/jpop/RTJTAAC/"}, tab => {
40
50
 
41
- chrome.tabs.executeScript(tab.id, {
51
+ chrome.scripting.executeScript(
42
52
 
43
- code: `
53
+ {
44
54
 
45
- document.querySelector(".cart-button").click();
55
+ target: {tabId: tab.id},
46
56
 
47
-
48
-
49
- `
57
+ function:click
50
58
 
51
59
  });
52
60
 
53
61
  });
62
+
63
+ clearInterval(Timer);
54
64
 
55
65
  }
56
66
 
@@ -65,6 +75,8 @@
65
75
  ```JSON
66
76
 
67
77
  {
78
+
79
+ {
68
80
 
69
81
  "name": "自動クリック",
70
82
 
@@ -92,10 +104,20 @@
92
104
 
93
105
  ],
94
106
 
107
+ "host_permissions":[
108
+
109
+ "http://*/",
110
+
111
+ "https://*/"
112
+
113
+ ],
114
+
95
115
 
96
116
 
97
117
  "action": {}
98
118
 
99
119
  }
100
120
 
121
+ }
122
+
101
123
  ```

2

先ほどの問題は解決したのだが別の問題が発生

2021/10/29 05:17

投稿

ryoma26
ryoma26

スコア6

test CHANGED
File without changes
test CHANGED
@@ -12,7 +12,7 @@
12
12
 
13
13
  ```
14
14
 
15
- Uncaught TypeError: Cannot read properties of undefined (reading 'create')
15
+ Error handling response: TypeError: chrome.tabs.executeScript is not a function
16
16
 
17
17
  ```
18
18
 
@@ -74,7 +74,11 @@
74
74
 
75
75
  "permissions": ["activeTab","scripting","tabs"],
76
76
 
77
-
77
+ "background": {
78
+
79
+ "service_worker": "content.js"
80
+
81
+ },
78
82
 
79
83
  "content_scripts": [
80
84
 

1

訂正

2021/10/27 14:08

投稿

ryoma26
ryoma26

スコア6

test CHANGED
File without changes
test CHANGED
@@ -38,7 +38,7 @@
38
38
 
39
39
  chrome.tabs.create({url: "https://ticket.rakuten.co.jp/music/jpop/RTZPALD/"}, tab => {
40
40
 
41
- chrome.tabs.executeScript(tab.class, {
41
+ chrome.tabs.executeScript(tab.id, {
42
42
 
43
43
  code: `
44
44