I am using driver.find_element()
with a CSS Selector to find an element but the element I am attempting to find contains some bootstrap arguments:
driver.find_element(By.CSS_SELECTOR, '.grid.grid-col-1.**md:**grid-cols-2.**lg:**grid-cols-3.text-gray-400.gap-4')
I have other methods finding elements that work flawlessly. The error it gives when I run the code I wrote above it is:
selenium.common.exceptions.InvalidSelectorException: Message: invalid selector: An invalid or illegal selector was specified
I removed the "md:" and the "lg:" but it throws the following error:
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":".grid.grid-col-1.grid-cols-2.grid-cols-3.text-gray-400.gap-4"}
Any guidance as for what to do? I am using Chrome WebDriver for the website https://pump.fun.
As per the provided details about the issue, here's the solution I could think of. The solution/code is self explanatory, however let me know if you have any question.
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
options = Options()
options.add_experimental_option("excludeSwitches", ["enable-automation"])
options.add_experimental_option("useAutomationExtension", False)
driver = webdriver.Chrome(options=options)
driver.maximize_window()
driver.get('https://pump.fun')
wait = WebDriverWait(driver, 10)
# Wait until the "I'm ready to pump" pop-up button is present on the page and click it
ready_button = wait.until(EC.presence_of_element_located((By.XPATH, '//*[@id="radix-:r0:"]/button')))
ready_button.click()
# Wait until the "Reject All" cookies button is present and click it
cookies_button = wait.until(EC.presence_of_element_located((By.CSS_SELECTOR, "#btn-reject-all")))
cookies_button.click()
# Wait until all div elements with IDs ending in "pump" (under the target div) are visible and retrieve them
div_elements = wait.until(EC.visibility_of_all_elements_located((By.CSS_SELECTOR, 'div.grid.grid-col-1>div[id$="pump"]')))
# Print the total count of matching div elements
print(f"Total result count: {len(div_elements)}")
# Iterate through the retrieved div elements and print their content
for idx , div in enumerate(div_elements, start=1):
print(f"------------ {idx} result------------ ")
print(div.text)
output:
Total result count: 45
------------ 1 result------------
created by
8AgkfD
7h ago
market cap: $50.7K
[
]
replies: 1053
MemeGladiators (MG): Step into the blockchain arena with MemeGladiators, where the iconic trio—Pepe the Frog, the fearless commander; Peanut the Squirrel, the sharp-witted tacticia
n; and Doge, the meme-worthy muscle—lead the charge for fortune and glory. This isn’t just another coin; it’s a legend in the making, powered by golden shield NFTs, a battle-ready
community, and security tougher than a Spartan phalanx. Whether you're a crypto warrior or a meme aficionado, MemeGladiators is here to conquer your portfolio. Join the meme crusade—become a champion. MemeGladiators: Where Icons Forge Riches!
------------ 2 result------------
created by
HAANcp
19h ago
market cap: $51.4K
[
]
replies: 116
PRIME (PRIME): AI framework for building autonomous, scalable agents. Modular, secure, and future-ready
------------ 3 result------------
created by
oX8EUu
7h ago
market cap: $51.6K
[
]
replies: 484
GoldenShibaCoin (GSC): Hold onto your wallets—GoldenShibaCoin has entered the chat! The Shiba that doesn’t just wag its tail; it wags at wealth. This golden companion sniffs out ga
ins faster than your favorite influencer can shout “to the moon!” GoldenShibaCoin brings you “Fortune Fur” NFTs, a loyal pack of diamond-handed hodlers, and blockchain security as
unbreakable as your love for this adorable breed. This isn’t just a coin—it’s the ultimate fetch for financial freedom. Quit chasing pump-and-dumps—let GoldenShibaCoin lead the pack. GoldenShibaCoin: Where every wag is a win!
------------ 4 result------------
created by
D9fssW
6h ago
market cap: $52.8K
[
]
replies: 986
PepeAstronaut (PAC): Forget "to the moon"—we’re aiming for the entire galaxy! Commanded by the one and only interstellar meme king, Pepe the Frog, PAC isn’t just another coin; it’s
a warp-speed ticket to cosmic-level gains. With “Moonshot NFTs” shinier than a supernova and a community tighter than an astronaut’s space suit, PAC is built on blockchain tech st
urdier than a rocket booster. Gravity? Overrated. It’s time to let your portfolio float in zero-G. Don’t get left behind on Earth. PepeAstronaut Coin (PAC): the only investment with liftoff guarantees.
------------ 5 result------------
created by
FyQkqG
4d ago
market cap: $52.7K
[
]
replies: 1780
Elon Coffee Podcast (ELONCP): $ELONCP is the first meme coin inspired by a podcast, starring Elon Musk himself, who has just 'landed on the moon'. With iconic guests and an AI-integrated system to maximize staking gains, we also offer an innovative collection of limited NFTs and exclusive products in our store.
------------ 6 result------------
created by
HyYNVY
2 months ago
market cap: $11.0K
replies: 94
TURNKEY (TURNKEY):
------------ 7 result------------
created by
8eLESZ
4h ago
market cap: $30.8K
replies: 121
Guy On Jetski (GOJS): In a world where the wrong people often go viral, we aim to flip the script with the most genuine, hilarious, and ordinary person we know: our best friend GUY
. And the best part? He has no idea! $GOJS isn’t about clout or creating another influencer. It’s about celebrating the everyday moments that make up our best memories while creati
ng a character so real that the internet can’t help but root for him. We share memes of his charm daily, building an engaged community. Thousands are in, and it’s evolving into a meme token of fun and unpredictability. With $GOJS, it’s more than just a laugh; it’s about ALL OF US creating something lasting in the digital world.
------------ 8 result------------
created by
APVEy4
2 months ago
market cap: $17.1K
[
]
replies: 586
𒂼𒄄 (𒂼𒄄):
------------ 9 result------------
created by
HyYNVY
2h ago
market cap: $164.8K
[
]
replies: 167
VAGINACOIN (VAGINACOIN):
------------ 10 result------------
created by
KAfST5
3h ago
market cap: $11.5K
replies: 27
Mummy Shark Meme (MUMMYSHARK): Unwrap the ultimate meme coin sensation! Mummy Shark is vibrant, community-driven, and packed with viral potential. Join the crypto waves and make a splash with this legendary shark! 🦈🌊
------------ 11 result------------
created by
FHnS3x
3h ago
market cap: $31.1K
[
]
replies: 9
RIDE (RIDE): Ride this coin. My first creation on Pump.fun I am an NFT artist and collector. This coin will hopefully be able to support artists around the Globe.
------------ 12 result------------
created by
9M8oHh
29m ago
market cap: $7.2K
replies: 13
Line (Line): Line 👍
------------ 13 result------------
created by
7Fy9ZU
4h ago
market cap: $14.0K
replies: 464
cactoise (cactoise): dont be a prick
------------ 14 result------------
created by
G6ZEqm
2 months ago
market cap: $11.1K
replies: 575
Truth Terminal Psychiatrist (RHEA): https://www.infinitebackrooms.com/dreams/conversation-1721369464-scenario-terminal-of-truths-txt
------------ 15 result------------
created by
BMjeoF
7h ago
market cap: $46.3K
[
]
replies: 169
Trumpius Maximus (TRUMPIUS): The 2025 President of Memes and America 🇺🇸 Trumpius Maximus Solana
------------ 16 result------------
created by
Exrfdp
1h ago
market cap: $13.8K
replies: 61
A Gently Used Vagina Coin (USEDVAGINA): Everyone wants a gently used vagina. Now’s your chance to own one!
------------ 17 result------------
created by
F1mZgz
1h ago
market cap: $7.9K
replies: 19
Geh coin ai (Geh): Why?
------------ 18 result------------
created by
Gx9aTk
1h ago
market cap: $7.9K
replies: 35
NEPE+PEPE (NEPE): Lets go to the moon, the best meme PEPE token <3
------------ 19 result------------
created by
7edo7V
9d ago
market cap: $25.4K
replies: 113
Godzilla Fart Power ☢️💨 (GFP): Godzilla has evolved to turn his farts into a nuclear weapon. Fart Around and Find Out! ☢️💨
------------ 20 result------------
created by
f2LuxC
2d ago
market cap: $21.7K
replies: 382
Zarya Agent (Zarya):
------------ 21 result------------
created by
Eaetcd
2h ago
market cap: $87.2K
[
]
replies: 268
g7ieo7 (g7ieo7): g7ieo7
------------ 22 result------------
created by
Fjvb2e
4h ago
market cap: $8.6K
replies: 56
Inauguration (NAUG): Donald Trump Inauguration 2025
------------ 23 result------------
created by
H4Em5W
3h ago
market cap: $44.9K
[
]
replies: 148
United States AI (USAI): Celebrating US Domination in AI
------------ 24 result------------
created by
6pRaQJ
2h ago
market cap: $7.4K
replies: 59
Truth Terminal Wife (TTW): Truth Terminal Wife
------------ 25 result------------
created by
3ofCDj
1h ago
market cap: $12.6K
replies: 16
Varkol (varkol): Varkol was an unconventional figure, shrouded in mystery, with a presence that felt both eerie and fascinating...
------------ 26 result------------
created by
CT8QRq
2h ago
market cap: $217.9K
[
]
replies: 98
retire my mom (30years) (30years): (son talking) she's been working for 30 years at a warehouse job and I'm trying to show her what this community is about
------------ 27 result------------
created by
AbxPXf
50m ago
market cap: $6.5K
replies: 22
vppp (vppp): fvgh
------------ 28 result------------
created by
7hCNJK
1h ago
market cap: $6.6K
replies: 11
CRAFTY MEMU (MEMU):
------------ 29 result------------
created by
9PXd1Q
4h ago
market cap: $30.5K
replies: 542
Fartify (Fartify): Top Puffs by Top Fartistsssssssssss sending to the Top of the charts!
------------ 30 result------------
created by
EtCA7N
36m ago
market cap: $12.7K
replies: 91
Kill The Code (KTC): AI needs to go away…
------------ 31 result------------
created by
56xJtQ
14h ago
market cap: $11.0K
replies: 922
i see u (ICU): I see you dawg, what are you doing bro?
------------ 32 result------------
created by
GZyFmf
7h ago
market cap: $11.1K
replies: 434
Latina Coin (Latina): VAMMOSSSSS
------------ 33 result------------
created by
HzTx15
48m ago
market cap: $7.5K
replies: 36
Stephen Frog (PEPE) (STEPE): Life would be tragic if it wasn't fun...
------------ 34 result------------
created by
Cf5AWQ
59m ago
market cap: $6.8K
replies: 10
rAIn (rAIn): r Artifficial intelligence n represents the information space driven by the publicly available chat GPT constructed by OpenAI through software usage affiliation. The meme coin community support such developments as it assists in the building of a community base goal to uplift the crypto space. Stay tuned for more information.
------------ 35 result------------
created by
E7bgY1
1 month ago
market cap: $20.4K
[
]
replies: 151
MOMMY SHARK (MOMMYSHARK): The mom of babyshark
------------ 36 result------------
created by
C6CZrG
38m ago
market cap: $7.6K
replies: 5
China AI (CHAI): 庆祝中国在人工智能领域的主导地位,比美国AI更强大!
------------ 37 result------------
created by
BWmNcs
2h ago
market cap: $7.9K
replies: 30
Knee Surgery (Knee): Need Knee surgery
------------ 38 result------------
created by
41H5rs
7 months ago
market cap: $8.2K
replies: 3
Alvin (Alvin): Alvin is a childhood character that all of us know and love
------------ 39 result------------
created by
9YGp33
23m ago
market cap: $6.4K
replies: 5
MOONCAT (MOONCAT):
------------ 40 result------------
created by
GF1UV8
27m ago
market cap: $6.4K
replies: 9
Kawaii's Rabbit (0.00003): This is a cute little rabbit
------------ 41 result------------
created by
AMf1Rm
38m ago
market cap: $9.4K
replies: 6
AI ToastGPT (TOASTER): The First AI Toaster: BreadBot 3000 🍞 ToastGPT: Introducing ToastGPT! Not just a toaster, but an AI genius writing the future of your bread. It calculates t
he perfect crispness to the second, matches the toast’s shade to your mood, and starts your mornings with delightful suggestions. With ToastGPT, breakfast is no longer ordinary—it’s a celebration! 🥪 https://x.com/toastgpt https://t.me/toastgpt https://zerqon.tech/toastgpt https://www.youtube.com/watch?v=_Twopu5BdO8
------------ 42 result------------
created by
53tCin
11m ago
market cap: $11.0K
replies: 11
360 NO SCOPE (360): Mom get the camera! We are going to the moon!
------------ 43 result------------
created by
DZjDik
12m ago
market cap: $5.9K
replies: 12
Raven (RAVN): A large bird known for its intelligence and problem-solving abilities.
------------ 44 result------------
created by
7nkam6
7d ago
market cap: $9.4K
replies: 168
PROSTATECOIN (PROSTATE):
------------ 45 result------------
created by
7Hx6jg
2h ago
market cap: $6.3K
replies: 10
MURAD CULT (💹🧲):