Emulating an Iphone 12 pro for instagram causing lazy scroll issues

userkiller

Newbie
Joined
Sep 19, 2010
Messages
39
Reaction score
13
Hey guys, I'm trying to emulate an iPhone 12 Pro to browse instagram. I've tried this method and it works partially but when I'm interacting with a screen that uses lazy scroll it loads new content without scrolling to the bottom.


Code:
mobile_emulation = {
"deviceName": "iPhone 12 Pro"
}
user_agent = "Mozilla/5.0 (iPhone; CPU iPhone OS 14_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 Mobile/15E148 Safari/604.1"
chrome_options = webdriver.ChromeOptions()
chrome_options.add_experimental_option("mobileEmulation", mobile_emulation)
chrome_options.add_argument(f'--user-agent={user_agent}')
driver = webdriver.Chrome(options=chrome_options)
driver.get('https://instagram.com')
time.sleep(222)

When I hit the users follower page the lazy scroll starts loading all of the users super fast which cause IG to think a bot. I get a similar behavior when emulating an Iphone 12 directly from the chrome developers tab.

This other method below with appium webdriver doesn't work because the desired_capabilities has been deprecated.



Code:
from appium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
# Create a capabilities object
caps = DesiredCapabilities.SAFARI.copy()
# Update the object with the desired capabilities for iPhone 12 Pro
caps.update({
"platformName": "iOS",
"platformVersion": "14.1",  # Adjust this based on your Xcode version
"deviceName": "iPhone 12 Pro",
"automationName": "XCUITest"
})
# Start the Appium session
driver = webdriver.Remote(command_executor="http://127.0.0.1:4723/wd/hub", desired_capabilities=caps)
# Navigate to Instagram
driver.get("https://instagram.com")
# End the session
driver.quit()

Here's a video of the behavior.

img404.jpg
 
Back
Top