OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

How to autofill forms on Google web page?

  • Thread starter Thread starter Kadir Buğra Akkuş
  • Start date Start date
K

Kadir Buğra Akkuş

Guest
My goal is to have the comments made by users on my website entered into the review section of my business on Google if they approve the comments. To make it easier for users, I plan to automatically fill in the ratings and comments given on my site into the Google Maps review panel. This way, users can publish the review if they wish.

Code:
function submitReview() {
        const rating = document.getElementById('rating').value;
        const comment = document.getElementById('comment').value;
        const google_maps_link = 'https://search.google.com/local/writereview?placeid=ChIJB6t1ora3yhQR9iK05hs-Y0g';

        if (rating === '5') {
            Swal.fire({
                title: 'Bizi Google\'da değerlendirir misiniz?',
                text: "Yorumunuz bizim için değerli!",
                icon: 'question',
                showCancelButton: true,
                confirmButtonColor: '#3085d6',
                cancelButtonColor: '#d33',
                confirmButtonText: 'Evet, değerlendiririm!'
            }).then((result) => {
                if (result.isConfirmed) {
                    window.location.href = google_maps_link;
                }
            });
        } else {
            Swal.fire({
                icon: 'success',
                title: 'Yorumunuz kaydedildi!',
                text: 'Yorumunuz için teşekkür ederiz.',
            });
        }
    }

I have tried a few different code structures, one of which is this:

Code:
localStorage.setItem('reviewComment', comment);

I add this block of code just before the redirection process to store the comment in memory.

Code:
if (window.location.href.includes('search.google.com/local/writereview')) {
        (() => {
            const selector = 'div[aria-label="Beş yıldız"]';
            const topics = document.querySelectorAll(selector);

            setTimeout(() => topics.click(), 1000);
        })();
    }

I then wait for this method to work. However, Google is blocking my JavaScript code. Is there an easier way to implement this structure?

<p>My goal is to have the comments made by users on my website entered into the review section of my business on Google if they approve the comments. To make it easier for users, I plan to automatically fill in the ratings and comments given on my site into the Google Maps review panel. This way, users can publish the review if they wish.</p>
<pre><code>function submitReview() {
const rating = document.getElementById('rating').value;
const comment = document.getElementById('comment').value;
const google_maps_link = 'https://search.google.com/local/writereview?placeid=ChIJB6t1ora3yhQR9iK05hs-Y0g';

if (rating === '5') {
Swal.fire({
title: 'Bizi Google\'da değerlendirir misiniz?',
text: "Yorumunuz bizim için değerli!",
icon: 'question',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Evet, değerlendiririm!'
}).then((result) => {
if (result.isConfirmed) {
window.location.href = google_maps_link;
}
});
} else {
Swal.fire({
icon: 'success',
title: 'Yorumunuz kaydedildi!',
text: 'Yorumunuz için teşekkür ederiz.',
});
}
}
</code></pre>
<p>I have tried a few different code structures, one of which is this:</p>
<pre><code>localStorage.setItem('reviewComment', comment);
</code></pre>
<p>I add this block of code just before the redirection process to store the comment in memory.</p>
<pre><code>if (window.location.href.includes('search.google.com/local/writereview')) {
(() => {
const selector = 'div[aria-label="Beş yıldız"]';
const topics = document.querySelectorAll(selector);

setTimeout(() => topics.click(), 1000);
})();
}
</code></pre>
<p>I then wait for this method to work. However, Google is blocking my JavaScript code. Is there an easier way to implement this structure?</p>
 

Latest posts

Top